26 #include <Classes.hpp>
27 #include <Controls.hpp>
28 #include <StdCtrls.hpp>
30 #include <Buttons.hpp>
31 #include <ExtCtrls.hpp>
33 #include <Dialogs.hpp>
34 #include <Graphics.hpp>
35 #include <ComCtrls.hpp>
51 #pragma package(smart_init)
64 Graphics::TBitmap* SmallGraphicPtrVal) : SpeedTag(SpeedTagVal), TrackType(TrackTypeVal), GraphicPtr(GraphicPtrVal), SmallGraphicPtr(SmallGraphicPtrVal)
66 for(
int x = 0; x < 4; x++)
77 else if(SpeedTagVal == 77)
81 else if(SpeedTagVal == 78)
85 else if(SpeedTagVal == 79)
89 else if(SpeedTagVal == 96)
93 else if(SpeedTagVal == 129)
97 else if(SpeedTagVal == 130)
101 else if(SpeedTagVal == 131)
105 else if(SpeedTagVal == 145)
109 else if(SpeedTagVal == 146)
118 FixedNamedLocationElement(false)
120 for(
int x = 0; x < 4; x++)
131 AnsiString(VLocInput));
144 if((this->
HLoc == RHElement.
HLoc) && (this->VLoc == RHElement.
VLoc) && (this->SpeedTag == RHElement.
SpeedTag))
158 if((this->
HLoc != RHElement.
HLoc) || (this->VLoc != RHElement.
VLoc) || (this->SpeedTag != RHElement.
SpeedTag))
174 Graphics::TBitmap *GraphicOutput = GraphicPtr;
176 if(LocationName ==
"")
221 GraphicOutput = GraphicPtr;
225 Disp->PlotOutput(34, HLoc * 16, VLoc * 16, GraphicOutput);
227 if((TrackType ==
Simple) && Failed)
239 AnsiString LogString =
"TrkEl:-," + AnsiString(ElementID) +
"," + LocationName +
"," + AnsiString(TrainIDOnElement) +
"," +
240 AnsiString(TrainIDOnBridgeOrFailedPointOrigSpeedLimit01) +
"," + AnsiString(TrainIDOnBridgeOrFailedPointOrigSpeedLimit23) +
",EndTrkEl,";
249 Attribute(0), CallingOnSet(false), Length01(
Track->DefaultTrackLength), Length23(-1), SpeedLimit01(
Track->DefaultTrackSpeedLimit), SpeedLimit23(-1),
250 TrainIDOnElement(-1), TrainIDOnBridgeOrFailedPointOrigSpeedLimit01(-1), TrainIDOnBridgeOrFailedPointOrigSpeedLimit23(-1), StationEntryStopLinkPos1(-1), StationEntryStopLinkPos2(-1),
251 SigAspect(FourAspect)
254 for(
int x = 0; x < 4; x++)
270 if(lower.second < higher.second)
274 else if(lower.second > higher.second)
278 else if(lower.second == higher.second)
280 if(lower.first < higher.first)
293 :
TTrackElement(ElementIn), ELink(ELinkIn), ELinkPos(ELinkPosIn), XLink(XLinkIn), XLinkPos(XLinkPosIn), TrackVectorPosition(TrackVectorPositionIn),
294 CheckCount(9), IsARoute(false), AutoSignals(false), PrefDirRoute(false)
298 throw Exception(
"EXNumber failure in TPrefDirElement constructor");
309 AnsiString LogString =
"PthEl:-," + AnsiString(
ELink) +
"," + AnsiString(
ELinkPos) +
"," + AnsiString(
XLink) +
"," + AnsiString(
XLinkPos) +
"," +
337 {2, 4}, {6, 2}, {8, 6}, {4, 8},
338 {1, 6}, {3, 8}, {9, 4}, {7, 2}, {1, 8}, {3, 4}, {9, 2}, {7, 6},
348 else if(
Link[2] == -1)
361 else if(
Link[2] == -1)
370 for(
int x = 0; x < 16; x++)
372 if(((Entry == EXArray[x][0]) && (Exit == EXArray[x][1])) || ((Entry == EXArray[x][1]) && (Exit == EXArray[x][0])))
548 throw Exception(
"Error in EntryExitNumber 4");
643 throw Exception(
"Error in EntryExitNumber 5");
737 throw Exception(
"Error in EntryExitNumber 6");
824 throw Exception(
"Error in EntryExitNumber 10");
913 throw Exception(
"Error in EntryExitNumber 11");
1009 throw Exception(
"Error in EntryExitNumber 7");
1040 throw Exception(
"Error in EntryExitNumber 8");
1051 if((ELink > 0) && (ELink < 10) && (ELink != 5))
1053 if(!AutoSigsFlag && !PrefDirRoute)
1057 else if(!AutoSigsFlag && PrefDirRoute)
1068 throw Exception(
"Error in EntryExitNumber 9");
1112 TTrack::TActiveLevelCrossing::TActiveLevelCrossing()
1136 AnsiString NL =
'\n';
1138 RouteFailMessage =
"Unable to set a route:" + NL + NL +
"it may be unreachable, perhaps because of failed points; " + NL + NL +
1139 "reachable but with too many different directions leading away from the start point - set some points on the route required; " + NL + NL +
1140 "blocked by a train, another route or a changing level crossing; " + NL + NL +
1141 "or invalid - possibly due to a preferred direction mismatch, or a missed signal in a blue route or green route restricted to consecutive signals.";
1148 int InternalLinkCheckArray[9][2] =
1149 {{1, 9}, {4, 6}, {7, 3}, {2, 8}, {0, 0}, {8, 2}, {3, 7}, {6, 4}, {9, 1}};
1154 for(
int x = 0; x < 9; x++)
1156 for(
int y = 0; y < 2; y++)
1163 TopPlatAllowed << 1 << 9 << 10 << 30 << 31 << 60 << 61 << 68 << 69 << 77 << 125 << 126 << 129 << 145;
1165 BotPlatAllowed << 1 << 7 << 8 << 28 << 29 << 60 << 61 << 68 << 69 << 76 << 125 << 126 << 129 << 145;
1166 LeftPlatAllowed << 2 << 12 << 14 << 33 << 35 << 62 << 63 << 70 << 71 << 79 << 127 << 128 << 130 << 146;
1167 RightPlatAllowed << 2 << 11 << 13 << 32 << 34 << 62 << 63 << 70 << 71 << 78 << 127 << 128 << 130 << 146;
1168 NameAllowed << 1 << 2 << 3 << 4 << 5 << 6 << 20 << 21 << 22 << 23 << 24 << 25 << 26 << 27
1169 << 60 << 61 << 62 << 63 << 68 << 69 << 70 << 71 << 80 << 81 << 82 << 83 << 125 << 126 << 127 << 128;
1175 int HVArray[10][2] =
1176 {{0, 0}, {-1, -1}, {0, -1}, {1, -1}, {-1, 0}, {0, 0}, {1, 0}, {-1, 1}, {0, 1}, {1, 1}};
1178 for(
int x = 0; x < 10; x++)
1180 for(
int y = 0; y < 2; y++)
1189 {{68, 0,
RailGraphics->
gl68}, {69, 0,
RailGraphics->
gl69}, {70, 0,
RailGraphics->
gl70}, {71, 0,
RailGraphics->
gl71}, {72, 0,
RailGraphics->
gl72},
1192 {68, 1,
RailGraphics->
bm68yellow}, {69, 1,
RailGraphics->
bm69yellow}, {70, 1,
RailGraphics->
bm70yellow}, {71, 1,
RailGraphics->
bm71yellow},
1193 {72, 1,
RailGraphics->
bm72yellow}, {73, 1,
RailGraphics->
bm73yellow}, {74, 1,
RailGraphics->
bm74yellow}, {75, 1,
RailGraphics->
bm75yellow},
1195 {68, 2,
RailGraphics->
bm68dblyellow}, {69, 2,
RailGraphics->
bm69dblyellow}, {70, 2,
RailGraphics->
bm70dblyellow}, {71, 2,
RailGraphics->
bm71dblyellow},
1196 {72, 2,
RailGraphics->
bm72dblyellow}, {73, 2,
RailGraphics->
bm73dblyellow}, {74, 2,
RailGraphics->
bm74dblyellow}, {75, 2,
RailGraphics->
bm75dblyellow},
1198 {68, 3,
RailGraphics->
bm68green}, {69, 3,
RailGraphics->
bm69green}, {70, 3,
RailGraphics->
bm70green}, {71, 3,
RailGraphics->
bm71green},
1199 {72, 3,
RailGraphics->
bm72green}, {73, 3,
RailGraphics->
bm73green}, {74, 3,
RailGraphics->
bm74green}, {75, 3,
RailGraphics->
bm75green},
1202 {70, 4,
RailGraphics->
gl70}, {71, 4,
RailGraphics->
gl71}, {72, 4,
RailGraphics->
gl72}, {73, 4,
RailGraphics->
bm73}, {74, 4,
RailGraphics->
bm74},
1205 for(
int x = 0; x < 40; x++)
1211 {{68, 0,
RailGraphics->
gl68}, {69, 0,
RailGraphics->
gl69}, {70, 0,
RailGraphics->
gl70}, {71, 0,
RailGraphics->
gl71}, {72, 0,
RailGraphics->
gl72},
1214 {68, 1,
RailGraphics->
bm68yellow}, {69, 1,
RailGraphics->
bm69yellow}, {70, 1,
RailGraphics->
bm70yellow}, {71, 1,
RailGraphics->
bm71yellow},
1215 {72, 1,
RailGraphics->
bm72yellow}, {73, 1,
RailGraphics->
bm73yellow}, {74, 1,
RailGraphics->
bm74yellow}, {75, 1,
RailGraphics->
bm75yellow},
1217 {68, 2,
RailGraphics->
bm68green}, {69, 2,
RailGraphics->
bm69green}, {70, 2,
RailGraphics->
bm70green}, {71, 2,
RailGraphics->
bm71green},
1218 {72, 2,
RailGraphics->
bm72green}, {73, 2,
RailGraphics->
bm73green}, {74, 2,
RailGraphics->
bm74green}, {75, 2,
RailGraphics->
bm75green},
1220 {68, 3,
RailGraphics->
bm68green}, {69, 3,
RailGraphics->
bm69green}, {70, 3,
RailGraphics->
bm70green}, {71, 3,
RailGraphics->
bm71green},
1221 {72, 3,
RailGraphics->
bm72green}, {73, 3,
RailGraphics->
bm73green}, {74, 3,
RailGraphics->
bm74green}, {75, 3,
RailGraphics->
bm75green},
1224 {70, 4,
RailGraphics->
gl70}, {71, 4,
RailGraphics->
gl71}, {72, 4,
RailGraphics->
gl72}, {73, 4,
RailGraphics->
bm73}, {74, 4,
RailGraphics->
bm74},
1227 for(
int x = 0; x < 40; x++)
1233 {{68, 0,
RailGraphics->
gl68}, {69, 0,
RailGraphics->
gl69}, {70, 0,
RailGraphics->
gl70}, {71, 0,
RailGraphics->
gl71}, {72, 0,
RailGraphics->
gl72},
1236 {68, 1,
RailGraphics->
bm68green}, {69, 1,
RailGraphics->
bm69green}, {70, 1,
RailGraphics->
bm70green}, {71, 1,
RailGraphics->
bm71green},
1237 {72, 1,
RailGraphics->
bm72green}, {73, 1,
RailGraphics->
bm73green}, {74, 1,
RailGraphics->
bm74green}, {75, 1,
RailGraphics->
bm75green},
1239 {68, 2,
RailGraphics->
bm68green}, {69, 2,
RailGraphics->
bm69green}, {70, 2,
RailGraphics->
bm70green}, {71, 2,
RailGraphics->
bm71green},
1240 {72, 2,
RailGraphics->
bm72green}, {73, 2,
RailGraphics->
bm73green}, {74, 2,
RailGraphics->
bm74green}, {75, 2,
RailGraphics->
bm75green},
1242 {68, 3,
RailGraphics->
bm68green}, {69, 3,
RailGraphics->
bm69green}, {70, 3,
RailGraphics->
bm70green}, {71, 3,
RailGraphics->
bm71green},
1243 {72, 3,
RailGraphics->
bm72green}, {73, 3,
RailGraphics->
bm73green}, {74, 3,
RailGraphics->
bm74green}, {75, 3,
RailGraphics->
bm75green},
1246 {70, 4,
RailGraphics->
gl70}, {71, 4,
RailGraphics->
gl71}, {72, 4,
RailGraphics->
gl72}, {73, 4,
RailGraphics->
bm73}, {74, 4,
RailGraphics->
bm74},
1249 for(
int x = 0; x < 40; x++)
1275 for(
int x = 0; x < 40; x++)
1281 {{68, 0,
RailGraphics->
FSig68}, {69, 0,
RailGraphics->
FSig69}, {70, 0,
RailGraphics->
FSig70}, {71, 0,
RailGraphics->
FSig71}, {72, 0,
RailGraphics->
FSig72},
1284 for(
int x = 0; x < 8; x++)
1311 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1312 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {-1, 0, 77},
1313 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {0, 0, 77}, {-1, 0, 78},
1314 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {-1, 0, 79},
1315 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {0, -1, 129},
1316 {0, 0, 129}, {0, -1, 145},
1319 for(
int x = 0; x < 25; x++)
1321 for(
int y = 0; y < 3; y++)
1329 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1330 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {0, 0, 76}, {-1, 0, 77},
1331 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {-1, 0, 78},
1332 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {-1, 0, 79},
1333 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {0, 1, 129},
1334 {0, 0, 129}, {0, 1, 145},
1337 for(
int x = 0; x < 25; x++)
1339 for(
int y = 0; y < 3; y++)
1347 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1348 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {-1, 0, 77},
1349 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {-1, 0, 78},
1350 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {-1, 0, 79},
1351 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {0, 0, 79}, {-1, 0, 130},
1352 {0, 0, 130}, {-1, 0, 146},
1355 for(
int x = 0; x < 25; x++)
1357 for(
int y = 0; y < 3; y++)
1365 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1366 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {-1, 0, 77},
1367 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {-1, 0, 78},
1368 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {0, 0, 78}, {-1, 0, 79},
1369 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {1, 0, 130},
1370 {0, 0, 130}, {1, 0, 146},
1373 for(
int x = 0; x < 25; x++)
1375 for(
int y = 0; y < 3; y++)
1383 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1384 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {-1, 0, 77},
1385 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {-1, 0, 78},
1386 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {-1, 0, 79},
1387 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {0, 1, 129},
1388 {0, -1, 129}, {1, 0, 130},
1389 {-1, 0, 130}, {0, 1, 145},
1390 {0, -1, 145}, {1, 0, 146},
1393 for(
int x = 0; x < 28; x++)
1395 for(
int y = 0; y < 3; y++)
1413 for(
int x = 0; x < 8; x++)
1415 for(
int y = 0; y < 3; y++)
1433 for(
int x = 0; x < 8; x++)
1435 for(
int y = 0; y < 3; y++)
1453 for(
int x = 0; x < 8; x++)
1455 for(
int y = 0; y < 3; y++)
1473 for(
int x = 0; x < 8; x++)
1475 for(
int y = 0; y < 3; y++)
1483 {1, 0, 131}, {0, -1, 131}, {0, 1, 131}};
1485 for(
int x = 0; x < 4; x++)
1487 for(
int y = 0; y < 3; y++)
1495 0, 1, 2, 5, 6, 3, 4, 9, 10, 7, 8, 13, 14, 11, 12, 15, 16, 17, 19, 18, 22, 23, 20, 21, 26, 27, 24, 25, 30, 31, 28, 29, 34, 35, 32, 33, 38, 39, 36, 37, 42,
1496 43, 40, 41, 45, 44, 47, 46, 48, 49, 51, 50, 53, 52, 55, 54, 57, 56, 59, 58, 60, 61, 63, 62, 66, 67, 64, 65, 68, 69, 71, 70, 74, 75, 72, 73, 77, 76, 78,
1497 79, 80, 81, 83, 82, 86, 87, 84, 85, 88, 89, 91, 90, 94, 95, 92, 93, 96, 99, 100, 97, 98, 103, 104, 101, 102, 106, 105, 109, 110, 107, 108, 113, 114,
1498 111, 112, 117, 118, 115, 116, 119, 120, 121, 123, 122, 124, 125, 126, 128, 127, 129, 130, 131, 134, 133, 132, 135, 139, 138, 137, 136, 143, 142, 141,
1504 0, 1, 2, 4, 3, 6, 5, 8, 7, 10, 9, 12, 11, 14, 13, 15, 16, 17, 19, 18, 21, 20, 23, 22, 25, 24, 27, 26, 29, 28, 31, 30, 33, 32, 35, 34, 37, 36, 39, 38, 41,
1505 40, 43, 42, 45, 44, 47, 46, 48, 49, 51, 50, 53, 52, 55, 54, 57, 56, 59, 58, 61, 60, 62, 63, 65, 64, 67, 66, 69, 68, 70, 71, 73, 72, 75, 74, 76, 77, 79,
1506 78, 81, 80, 82, 83, 85, 84, 87, 86, 89, 88, 90, 91, 93, 92, 95, 94, 96, 98, 97, 100, 99, 102, 101, 104, 103, 106, 105, 108, 107, 110, 109, 112, 111,
1507 114, 113, 116, 115, 118, 117, 119, 120, 124, 122, 123, 121, 126, 125, 127, 128, 129, 130, 131, 132, 135, 134, 133, 137, 136, 139, 138, 142, 143, 140,
1513 0, 2, 1, 4, 6, 3, 5, 14, 12, 13, 11, 7, 9, 8, 10, 15, 16, 17, 19, 18, 25, 27, 24, 26, 21, 23, 20, 22, 35, 33, 34, 32, 28, 30, 29, 31, 41, 43, 40, 42, 37,
1514 39, 36, 38, 46, 47, 44, 45, 49, 48, 51, 50, 56, 57, 58, 59, 52, 53, 54, 55, 63, 62, 60, 61, 65, 67, 64, 66, 71, 70, 68, 69, 73, 75, 72, 74, 79, 78, 76,
1515 77, 83, 82, 80, 81, 85, 87, 84, 86, 91, 90, 88, 89, 93, 95, 92, 94, 96, 102, 104, 101, 103, 98, 100, 97, 99, 106, 105, 108, 110, 107, 109, 116, 118,
1516 115, 117, 112, 114, 111, 113, 120, 119, 122, 124, 121, 123, 127, 128, 126, 125, 130, 129, 131, 133, 134, 135, 132, 137, 138, 139, 136, 143, 142, 140,
1522 0, 2, 1, 5, 3, 6, 4, 11, 13, 12, 14, 10, 8, 9, 7, 15, 16, 17, 19, 18, 26, 24, 27, 25, 22, 20, 23, 21, 32, 34, 33, 35, 31, 29, 30, 28, 42, 40, 43, 41, 38,
1523 36, 39, 37, 46, 47, 44, 45, 49, 48, 51, 50, 56, 57, 58, 59, 52, 53, 54, 55, 62, 63, 61, 60, 66, 64, 67, 65, 70, 71, 69, 68, 74, 72, 75, 73, 78, 79, 77,
1524 76, 82, 83, 81, 80, 86, 84, 87, 85, 90, 91, 89, 88, 94, 92, 95, 93, 96, 103, 101, 104, 102, 99, 97, 100, 98, 106, 105, 109, 107, 110, 108, 117, 115,
1525 118, 116, 113, 111, 114, 112, 120, 119, 123, 121, 124, 122, 128, 127, 125, 126, 130, 129, 131, 135, 132, 133, 134, 139, 136, 137, 138, 142, 143, 141,
1547 delete UGMIt->second;
1623 Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
1624 Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
1626 Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
1633 Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
1634 Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
1647 {4, 6, -1, -1}, {2, 8, -1, -1}, {6, 8, -1, -1}, {4, 8, -1, -1}, {2, 6, -1, -1}, {2, 4, -1, -1},
1648 {4, 6, 4, 2}, {6, 4, 6, 2}, {4, 6, 4, 8}, {6, 4, 6, 8}, {8, 2, 8, 4}, {8, 2, 8, 6}, {2, 8, 2, 4}, {2, 8, 2, 6},
1650 {4, 6, 2, 8}, {1, 9, 3, 7},
1652 {3, 7, -1, -1}, {1, 9, -1, -1}, {7, 6, -1, -1}, {4, 9, -1, -1}, {1, 6, -1, -1}, {4, 3, -1, -1}, {3, 8, -1, -1}, {1, 8, -1, -1}, {2, 9, -1, -1},
1654 {4, 6, 4, 3}, {6, 4, 6, 1}, {4, 6, 4, 9}, {6, 4, 6, 7}, {8, 2, 8, 1}, {8, 2, 8, 3}, {2, 8, 2, 7}, {2, 8, 2, 9}, {9, 1, 9, 2}, {7, 3, 7, 2}, {3, 7, 3, 8}, {1, 9, 1, 8}, {9, 1, 9, 4}, {7, 3, 7, 6}, {3, 7, 3, 4}, {1, 9, 1, 6},
1657 {1, 9, 2, 8}, {2, 8, 3, 7}, {4, 6, 3, 7}, {1, 9, 4, 6},
1658 {2, 8, 4, 6}, {4, 6, 2, 8}, {3, 7, 1, 9}, {1, 9, 3, 7}, {2, 8, 1, 9}, {2, 8, 3, 7}, {3, 7, 2, 8}, {1, 9, 2, 8}, {4, 6, 3, 7}, {4, 6, 1, 9}, {1, 9, 4, 6}, {3, 7, 4, 6},
1659 {4, 6, -1, -1}, {6, 4, -1, -1}, {8, 2, -1, -1}, {2, 8, -1, -1}, {1, 9, -1, -1}, {3, 7, -1, -1}, {7, 3, -1, -1}, {9, 1, -1, -1},
1660 {4, 6, -1, -1}, {4, 6, -1, -1}, {2, 8, -1, -1}, {2, 8, -1, -1}, {1, 9, -1, -1}, {3, 7, -1, -1}, {3, 7, -1, -1}, {1, 9, -1, -1},
1661 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1662 {4, 6, -1, -1}, {6, 4, -1, -1}, {8, 2, -1, -1}, {2, 8, -1, -1}, {1, 9, -1, -1}, {3, 7, -1, -1}, {7, 3, -1, -1}, {9, 1, -1, -1},
1663 {4, 6, -1, -1}, {6, 4, -1, -1}, {8, 2, -1, -1}, {2, 8, -1, -1}, {1, 9, -1, -1}, {3, 7, -1, -1}, {7, 3, -1, -1}, {9, 1, -1, -1},
1665 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1666 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1667 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1668 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1669 {4, 6, -1, -1}, {4, 6, -1, -1}, {2, 8, -1, -1}, {2, 8, -1, -1},
1670 {4, 6, -1, -1}, {2, 8, -1, -1},
1672 {8, 1, 8, 3}, {4, 3, 4, 9}, {2, 9, 2, 7}, {6, 7, 6, 1}, {9, 4, 9, 2}, {7, 2, 7, 6}, {1, 6, 1, 8}, {3, 8, 3, 4},
1674 {3, 7, -1, -1}, {3, 7, -1, -1}, {1, 9, -1, -1}, {1, 9, -1, -1},
1676 {4, 6, -1, -1}, {2, 8, -1, -1},
1681 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1682 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1683 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1684 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1687 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1688 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1689 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1691 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1692 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1693 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1695 {
CrossConn,
CrossConn,
CrossConn,
CrossConn}, {
CrossConn,
CrossConn,
CrossConn,
CrossConn}, {
CrossConn,
CrossConn,
CrossConn,
CrossConn},
1697 {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under},
1698 {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under},
1699 {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under},
1700 {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under},
1701 {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet},
1702 {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet},
1703 {
Connection,
Signal,
NotSet,
NotSet}, {
Signal,
Connection,
NotSet,
NotSet}, {
Signal,
Connection,
NotSet,
NotSet}, {
Connection,
Signal,
NotSet,
NotSet},
1704 {
Signal,
Connection,
NotSet,
NotSet}, {
Signal,
Connection,
NotSet,
NotSet}, {
Connection,
Signal,
NotSet,
NotSet}, {
Connection,
Signal,
NotSet,
NotSet},
1705 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1706 {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet},
1707 {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet},
1708 {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet},
1709 {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet},
1711 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1712 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1713 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1714 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1715 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1716 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1717 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1718 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1722 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1723 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1724 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1730 for(
int x = 0; x < 17; x++)
1732 FixedTrackPiece[x] =
TFixedTrackPiece(x, TrackTypeArray[x], Links[x], Configs[x], TrackImageArray[x], SmallTrackImageArray[x]);
1734 FixedTrackPiece[17] =
TFixedTrackPiece(17, TrackTypeArray[17], Links[17], Configs[17], 0, 0);
1738 FixedTrackPiece[x] =
TFixedTrackPiece(x, TrackTypeArray[x], Links[x], Configs[x], TrackImageArray[x], SmallTrackImageArray[x]);
1744 ExistingGraphicLoaded(false), Width(16), Height(16)
1756 ExistingGraphicLoaded(false), Width(WidthIn), Height(HeightIn)
1794 throw Exception(
"Overlay not loaded in TGraphicElement::LoadOriginalScreenGraphic()");
1798 throw Exception(
"Overlay not 16x16 in TGraphicElement::LoadOriginalScreenGraphic()");
1802 throw Exception(
"Source not set in TGraphicElement::LoadOriginalScreenGraphic()");
1806 throw Exception(
"ExistingGraphicLoaded in TGraphicElement::LoadOriginalScreenGraphic()");
1829 AnsiString(VOffset) +
"," + AnsiString(WidthIn) +
"," + AnsiString(HeightIn));
1832 throw Exception(
"Overlay not loaded in TGraphicElement::LoadOriginalExistingGraphic()");
1836 throw Exception(
"Source not set in TGraphicElement::LoadOriginalExistingGraphic()");
1840 throw Exception(
"ScreenGraphicLoaded in TGraphicElement::LoadOriginalExistingGraphic()");
1874 throw Exception(
"Overlay not loaded in TGraphicElement::PlotOverlay()");
1895 throw Exception(
"Original not loaded in TGraphicElement::PlotOriginal()");
1909 bool TrackPresent =
false;
1923 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
1927 TrackPresent =
true;
1932 return(!TrackPresent);
1940 bool TrackPresent =
false;
1949 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
1953 TrackPresent =
true;
1959 return(!TrackPresent);
1964 void TTrack::EraseTrackElement(
int Caller,
int HLocInput,
int VLocInput,
int &ErasedTrackVectorPosition,
bool &TrackEraseSuccessfulFlag,
bool InternalChecks)
1967 AnsiString(VLocInput) +
"," + AnsiString((
short)InternalChecks));
1968 TrackEraseSuccessfulFlag =
false;
1973 ErasedTrackVectorPosition = -1;
1974 AnsiString SName =
"", ErrorString;
1976 THVPair TrackMapKeyPair, InactiveTrackMapKeyPair;
1982 TrackMapKeyPair.first = HLocInput;
1983 TrackMapKeyPair.second = VLocInput;
1984 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
1995 if(ErrorString !=
"")
1997 throw Exception(ErrorString +
" for EraseTrackElement 1");
2021 ErasedTrackVectorPosition = VecPos;
2022 TrackEraseSuccessfulFlag =
true;
2028 unsigned int VecPos;
2029 InactiveTrackMapKeyPair.first = HLocInput;
2030 InactiveTrackMapKeyPair.second = VLocInput;
2035 VecPos = InactiveTrack2MultiMapIterator->second;
2040 if(ErrorString !=
"")
2042 throw Exception(ErrorString +
" for EraseTrackElement 2A");
2052 TrackEraseSuccessfulFlag =
true;
2073 VecPos = InactiveTrack2MultiMapIterator->second;
2078 if(ErrorString !=
"")
2080 throw Exception(ErrorString +
" for EraseTrackElement 2B");
2104 if(TrackEraseSuccessfulFlag)
2126 AnsiString(HLocInput) +
"," + AnsiString(VLocInput) +
"," + AnsiString((
short)InternalChecks));
2127 bool PlatAllowedFlag =
false;
2129 TrackLinkingRequiredFlag =
false;
2141 LocationNameEntry.first =
"";
2149 TempTrackElement.
HLoc = HLocInput;
2150 TempTrackElement.
VLoc = VLocInput;
2176 else if(Aspect == 1)
2180 else if(Aspect == 2)
2184 else if(Aspect == 3)
2193 bool FoundFlag =
false, InactiveFoundFlag =
false, NonStationOrLevelCrossingPresent =
false, PlatformPresent =
false;
2196 int InactiveSpeedTag1 = 0, InactiveSpeedTag2 = 0;
2198 if(InactiveFoundFlag)
2202 NonStationOrLevelCrossingPresent =
true;
2206 NonStationOrLevelCrossingPresent =
true;
2210 PlatformPresent =
true;
2221 if(InactiveFoundFlag && ((TempTrackElement.
SpeedTag == InactiveSpeedTag1) || (TempTrackElement.
SpeedTag == InactiveSpeedTag2)))
2229 PlatAllowedFlag =
true;
2233 PlatAllowedFlag =
true;
2237 PlatAllowedFlag =
true;
2241 PlatAllowedFlag =
true;
2245 TrackLinkingRequiredFlag =
true;
2273 if((FoundFlag && (
NameAllowed.Contains(
TrackElementAt(1048, VecPos).SpeedTag)) && !PlatformPresent && !InactiveFoundFlag) ||
2274 (!FoundFlag && !InactiveFoundFlag))
2277 TrackLinkingRequiredFlag =
true;
2309 TrackLinkingRequiredFlag =
true;
2321 else if(FoundFlag || InactiveFoundFlag)
2340 bool BothPointFillets =
true;
2355 TrackLinkingRequiredFlag =
true;
2369 bool InternalChecks)
2373 AnsiString(VLocInput) +
"," + AnsiString((
short)InternalChecks));
2374 bool PlatAllowedFlag =
false;
2376 TrackLinkingRequiredFlag =
false;
2379 LocationNameEntry.first =
"";
2385 TempTrackElement.
HLoc = HLocInput;
2386 TempTrackElement.
VLoc = VLocInput;
2387 for(
int x = 0; x < 4; x++)
2393 TempTrackElement.
Conn[x] = -1;
2397 bool FoundFlag =
false, InactiveFoundFlag =
false, NonStationOrLevelCrossingPresent =
false, PlatformPresent =
false;
2408 int InactiveSpeedTag1 = 0, InactiveSpeedTag2 = 0;
2410 if(InactiveFoundFlag)
2414 NonStationOrLevelCrossingPresent =
true;
2418 NonStationOrLevelCrossingPresent =
true;
2422 PlatformPresent =
true;
2433 if(InactiveFoundFlag && ((TempTrackElement.
SpeedTag == InactiveSpeedTag1) || (TempTrackElement.
SpeedTag == InactiveSpeedTag2)))
2441 PlatAllowedFlag =
true;
2445 PlatAllowedFlag =
true;
2449 PlatAllowedFlag =
true;
2453 PlatAllowedFlag =
true;
2457 TrackLinkingRequiredFlag =
true;
2488 if((FoundFlag && (
NameAllowed.Contains(
TrackElementAt(1055, VecPos).SpeedTag)) && !PlatformPresent && !InactiveFoundFlag) ||
2489 (!FoundFlag && !InactiveFoundFlag))
2492 TrackLinkingRequiredFlag =
true;
2527 TrackLinkingRequiredFlag =
true;
2539 else if(FoundFlag || InactiveFoundFlag)
2558 bool BothPointFillets =
true;
2573 TrackLinkingRequiredFlag =
true;
2603 ShowMessage(
"Gaps must be set before track can be validated");
2613 throw Exception(
"Error, gaps unset when TryToConnectTrack called");
2624 if(!
LinkTrack(1, LocError, HLoc, VLoc,
false))
2641 ShowMessage(
"Error in RepositionAndMapTrack during TryToConnectTrack. Railway file is corrupt, further use may cause a system crash");
2648 if(!
LinkTrack(2, LocError, HLoc, VLoc,
true))
2672 std::pair<AnsiString, char>TempMapPair;
2680 TempMapPair.second =
'x';
2690 AnsiString Name =
"";
2691 typedef std::list<AnsiString> TNoPlatsList;
2692 TNoPlatsList::iterator NPLIt;
2693 TNoPlatsList NoPlatsList;
2694 typedef std::list<AnsiString> TLocNameList;
2695 TLocNameList LocNameList;
2700 LocNameList.push_back(LNMMIt->first);
2703 LocNameList.unique();
2704 for(TLocNameList::iterator LNLIt = LocNameList.begin(); LNLIt != LocNameList.end(); LNLIt++)
2708 if(MMRange.first == MMRange.second)
2714 if((LNMMIt->second) < 0)
2728 TempIt = MMRange.second;
2729 if(LNMMIt == --TempIt)
2731 NoPlatsList.push_back(Name);
2735 if(!NoPlatsList.empty())
2737 AnsiString NoPlatsAnsiList =
"";
2738 for(NPLIt = NoPlatsList.begin(); NPLIt != NoPlatsList.end(); NPLIt++)
2740 NoPlatsAnsiList += *NPLIt +
'\n';
2744 if(NoPlatsList.size() > 1)
2746 ShowMessage(
"Please note: the following locations have no platforms, trains won't be able to stop or pass there:-\n\n" + NoPlatsAnsiList +
"\nThis message will not be shown again.");
2750 ShowMessage(
"Please note: the following location has no platforms, trains won't be able to stop or pass there:-\n\n" + NoPlatsAnsiList +
"\nThis message will not be shown again.");
2765 int NewHLoc, NewVLoc;
2766 bool ConnectionFoundFlag, LinkFoundFlag;
2768 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
2770 for(
unsigned int y = 0; y < 4; y++)
2788 ConnectionFoundFlag =
false;
2789 for(
unsigned int z = 0; z <
TrackVector.size(); z++)
2795 ConnectionFoundFlag =
true;
2797 LinkFoundFlag =
false;
2798 for(
unsigned int a = 0; a < 4; a++)
2802 LinkFoundFlag =
true;
2818 if(!ConnectionFoundFlag)
2893 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
2910 bool UnsetGaps =
false;
2917 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
2921 for(
unsigned int y = 0; y < 4; y++)
2933 for(
unsigned int y = 0; y < 4; y++)
2943 for(
unsigned int y = 1; y < 4; y++)
2952 for(
unsigned int y = 0; y < 4; y++)
2965 for(
unsigned int y = 0; y < 4; y++)
2993 int NumberOfActiveElements = 0;
2995 GraphicsFollow =
false;
2999 if(MarkerString[MarkerString.Length()] ==
'1')
3001 GraphicsFollow =
true;
3003 for(
int x = 0; x < NumberOfActiveElements; x++)
3009 TrackElement.
HLoc = TempInt;
3011 TrackElement.
VLoc = TempInt;
3017 TrackElement.
Conn[0] = TempInt;
3041 if((TempInt != -1) && (TempInt < 10))
3051 if((TempInt != -1) && (TempInt < 10))
3068 if(Marker[1] ==
'3')
3072 else if(Marker[1] ==
'2')
3076 else if(Marker[1] ==
'G')
3090 int NumberOfInactiveElements = 0;
3094 for(
int x = 0; x < NumberOfInactiveElements; x++)
3100 TrackElement.
HLoc = TempInt;
3102 TrackElement.
VLoc = TempInt;
3108 bool LocError =
false;
3137 for(
int x = 0; x < NumberOfGraphics; x++)
3148 bool FileError =
false;
3150 for(
int x = 0; x < NumberOfGraphics; x++)
3163 UGME.second =
new TPicture;
3164 UGME.second->LoadFromFile(
UGME.first);
3167 throw Exception(
"Map Insertion Error 2 - UserGraphicMap insertion failure for " + UGI.
FileName);
3174 catch(
const EInvalidGraphic &e)
3183 delete UGMIt->second;
3188 catch(
const Exception &e)
3197 delete UGMIt->second;
3205 bool FoundInMap =
false;
3224 UGME.second =
new TPicture;
3225 UGME.second->LoadFromFile(
UGME.first);
3228 throw Exception(
"Map Insertion Error 3 - UserGraphicMap insertion failure for " + UGI.
FileName);
3235 catch(
const EInvalidGraphic &e)
3244 delete UGMIt->second;
3249 catch(
const Exception &e)
3258 delete UGMIt->second;
3283 VecFile <<
"**Active elements**1" <<
'\0' <<
'\n';
3287 VecFile <<
"**Active elements**" <<
'\0' <<
'\n';
3289 for(
unsigned int x = 0; x < (
TrackVector.size()); x++)
3292 VecFile << x <<
'\n';
3293 VecFile << TrackElement.
SpeedTag <<
'\n';
3294 VecFile << TrackElement.
HLoc <<
'\n';
3295 VecFile << TrackElement.
VLoc <<
'\n';
3299 VecFile << TrackElement.
Conn[0] <<
'\n';
3303 VecFile << TrackElement.
Attribute <<
'\n';
3309 VecFile << int(1) <<
'\n';
3313 VecFile << int(0) <<
'\n';
3316 VecFile << TrackElement.
Length01 <<
'\n';
3317 VecFile << TrackElement.
Length23 <<
'\n';
3320 VecFile << TrackElement.
LocationName.c_str() <<
'\0' <<
'\n';
3327 VecFile <<
"3*****" <<
'\0' <<
'\n';
3331 VecFile <<
"2*****" <<
'\0' <<
'\n';
3335 VecFile <<
"G*****" <<
'\0' <<
'\n';
3339 VecFile <<
"4*****" <<
'\0' <<
'\n';
3344 VecFile <<
"******" <<
'\0' <<
'\n';
3349 VecFile <<
"**Inactive elements**" <<
'\0' <<
'\n';
3353 VecFile << x <<
'\n';
3354 VecFile << InactiveTrackElement.
SpeedTag <<
'\n';
3355 VecFile << InactiveTrackElement.
HLoc <<
'\n';
3356 VecFile << InactiveTrackElement.
VLoc <<
'\n';
3357 VecFile << InactiveTrackElement.
LocationName.c_str() <<
'\0' <<
'\n';
3358 VecFile <<
"******" <<
'\0' <<
'\n';
3373 GraphicsFollow =
false;
3375 if((NumberOfActiveElements < 0) || (NumberOfActiveElements > 1000000))
3381 AnsiString MarkerString;
3388 if(MarkerString[MarkerString.Length()] ==
'1')
3390 GraphicsFollow =
true;
3392 for(
int x = 0; x < NumberOfActiveElements; x++)
3400 int SpeedTag = TempInt;
3407 if(((TempInt > 999999) || (TempInt < -1000001)) && (TempInt != -2000000000))
3413 if(((TempInt > 999999) || (TempInt < -1000001)) && (TempInt != -2000000000))
3418 if((SpeedTag > 87) && (SpeedTag < 96))
3421 if((TempInt < -1) || (TempInt > 3))
3427 if((TempInt < -1) || (TempInt > 999999))
3433 if(((SpeedTag >= 7) && (SpeedTag <= 14)) || ((SpeedTag >= 28) && (SpeedTag <= 43)) || ((SpeedTag >= 132) && (SpeedTag <= 139)) ||
3434 ((SpeedTag >= 68) && (SpeedTag <= 75)))
3437 if((TempInt < -1) || (TempInt > 5))
3443 if((SpeedTag >= 68) && (SpeedTag <= 75))
3446 if((TempInt != 0) && (TempInt != 1))
3453 if((TempInt < -1) || (TempInt > 999999))
3459 if((TempInt < -1) || (TempInt > 999999))
3465 if((TempInt < -1) || (TempInt > 999999))
3471 if((TempInt < -1) || (TempInt > 999999))
3492 int NumberOfInactiveElements = 0;
3495 if(NumberOfInactiveElements < 0)
3505 for(
int x = 0; x < NumberOfInactiveElements; x++)
3519 if(((TempInt > 999999) || (TempInt < -1000001)) && (TempInt != -2000000000))
3525 if(((TempInt > 999999) || (TempInt < -1000001)) && (TempInt != -2000000000))
3552 if((NumberOfGraphics < 0) || (NumberOfGraphics > 100000))
3558 AnsiString FileName =
"", TempStr =
"";
3560 for(
int x = 0; x < NumberOfGraphics; x++)
3562 TPicture *TempPicture =
new TPicture;
3571 TempPicture->LoadFromFile(GraphicsPath +
"\\" + FileName);
3584 catch(
const EInvalidGraphic &e)
3589 for(
int y = x + 1; y < NumberOfGraphics; y++)
3595 ShowMessage(FileName +
3596 " has an incorrect file format, user graphics can't be loaded. Ensure that all user graphic files are valid with extension .bmp, .gif, .jpg, or .png");
3601 catch(
const Exception &e)
3606 for(
int y = x + 1; y < NumberOfGraphics; y++)
3612 ShowMessage(
"Unable to load user graphic files, ensure that " + FileName +
3613 " exists in the 'Graphics' folder and that it is has extension .bmp, .gif, .jpg, or .png.");
3631 for(
int x = 0; x < VecSize; x++)
3654 for(
int x = 0; x < VecSize; x++)
3676 for(
int x = 0; x < VecSize; x++)
3730 for(
int x = 0; x < VecSize; x++)
3788 PlotPoints(5, Next, Disp, BothPointFilletsAndBasicLCs);
3810 if(BothPointFilletsAndBasicLCs)
3885 Bitmap->Canvas->CopyMode = cmSrcCopy;
3887 Graphics::TBitmap *GraphicOutput;
4062 for(
int x = 0; x < 40; x++)
4091 Graphics::TBitmap *GraphicPtr;
4106 Graphics::TBitmap* SignalPlatformGraphic;
4139 if(OldTransparentColour !=
clB5G5R5)
4162 Bitmap->Canvas->CopyMode = cmSrcCopy;
4190 Bitmap->Canvas->CopyMode = cmSrcCopy;
4192 Graphics::TBitmap *GraphicOutput;
4202 if(BaseElement == 1)
4298 for(
int x = 0; x < 40; x++)
4327 Graphics::TBitmap *GraphicPtr;
4342 Graphics::TBitmap* SignalPlatformGraphic;
4405 for(
int x = 0; x < 40; x++)
4413 Graphics::TBitmap* SignalPlatformGraphic;
4446 if(OldTransparentColour !=
clB5G5R5)
4460 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4532 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4546 ShowMessage(
"Error - gap connected to a non-gap. Railway file is corrupt, further use may cause a system crash");
4572 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4597 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4627 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4661 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4698 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4715 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4746 for(TrackMapPtr =
TrackMap.begin(); TrackMapPtr !=
TrackMap.end(); TrackMapPtr++)
4753 throw Exception(
"Error - Map & Vector different sizes");
4755 unsigned int NonZeroCount = 0;
4757 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4766 throw Exception(
"Error - NewVector & NonZero TrackVector different sizes");
4772 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4776 TrackMapEntry.first = TrackMapKeyPair;
4777 TrackMapEntry.second = x;
4778 if(!(
TrackMap.insert(TrackMapEntry).second))
4780 throw Exception(
"Error - map insertion failure, TrackVector in error");
4784 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4786 for(
unsigned int y = 0; y < 4; y++)
4811 THVPair GapMapKeyPair, GapMapValuePair;
4814 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4820 GapMapEntry.first = GapMapKeyPair;
4823 throw Exception(
"Error - Gap connection == -1 Can't build GapMap");
4827 GapMapEntry.second = GapMapValuePair;
4830 GapMap.insert(GapMapEntry);
4845 bool TrackElementPositionsOK =
true;
4847 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4859 "Footbridge or underpass connection error. Each end must connect to a platform, concourse "
4860 "or other footbridge or underpass, and they can't connect to each other (i.e. a footbridge "
4861 "can't connect to an underpass or vice versa)");
4869 for(
unsigned int y = 0; y < 4; y++)
4887 bool ConnectionFoundFlag;
4891 ShowMessage(
"Can't have a track element adjacent to a continuation exit");
4897 throw Exception(
"Error in final track linkage - continuation adjacent to another element");
4906 if(ConnectionFoundFlag)
4913 ShowMessage(
"Can't have an exit signal next to a level crossing - it can cause the train to foul the crossing in some circumstances");
4915 TrackElementPositionsOK =
false;
4920 ShowMessage(
"Can't have points, crossover or signal next to buffers - need room for a train without fouling");
4922 TrackElementPositionsOK =
false;
4927 ShowMessage(
"Can't have points, crossover, bridge or signal next to a continuation - it can cause route setting problems");
4931 TrackElementPositionsOK =
false;
4936 ShowMessage(
"Can't have two same-direction signals adjacent to each other as there is no room for a train between them");
4939 TrackElementPositionsOK =
false;
4943 ShowMessage(
"Signal facing a bridge - routes can't be truncated to this or other such signals.\n\nThis restriction can be removed or reinstated by pressing\nCTRL ALT 5. When removed this message will not be shown again.");
4946 TrackElementPositionsOK =
false;
4951 ShowMessage(
"Can't have two level crossings adjacent to each other on the same track");
4952 TrackElementPositionsOK =
false;
4955 if(!TrackElementPositionsOK)
4962 throw Exception(
"Error in track element positions in FinalCall");
4975 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4981 for(
unsigned int y = 0; y < 4; y++)
5003 bool ConnectionFoundFlag;
5004 bool LinkMatchFound =
false;
5007 if(ConnectionFoundFlag)
5009 for(
unsigned int a = 0; a < 4; a++)
5018 LinkMatchFound =
true;
5029 throw Exception(
"Error in final track linkage - - no matching link found");
5042 throw Exception(
"Error in final track linkage - connection not found");
5057 bool ConnErrorFlag =
false;
5059 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5063 ConnErrorFlag =
true;
5067 ConnErrorFlag =
true;
5071 ConnErrorFlag =
true;
5075 ConnErrorFlag =
true;
5083 throw Exception(
"Error, StationEntryStopLinkPos not -1 for unnamed element at TrackVectorPosition = " + AnsiString(x));
5092 throw Exception(
"ConnError in LinkTrack - Final");
5096 throw Exception(
"ConnError in LinkTrack - Precheck");
5099 bool CLkErrorFlag =
false;
5101 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5105 CLkErrorFlag =
true;
5109 CLkErrorFlag =
true;
5113 CLkErrorFlag =
true;
5117 CLkErrorFlag =
true;
5125 throw Exception(
"CLkError in LinkTrack - Final");
5129 throw Exception(
"CLkError in LinkTrack - Precheck");
5134 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5164 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5180 for(
unsigned int y = 0; y < 4; y++)
5199 bool ConnectionFoundFlag;
5205 throw Exception(
"Error in final track linkage - continuation adjacent to another element");
5214 if(ConnectionFoundFlag)
5217 bool LinkFoundFlag =
false;
5274 for(
unsigned int a = 0; a < 4; a++)
5283 LinkFoundFlag =
true;
5291 throw Exception(
"Error in final track linkage in LinkTrackNoMessages - invalid link");
5301 throw Exception(
"Error in final track linkage in LinkTrackNoMessages - connection not found");
5314 bool ConnErrorFlag =
false;
5316 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5320 ConnErrorFlag =
true;
5324 ConnErrorFlag =
true;
5328 ConnErrorFlag =
true;
5332 ConnErrorFlag =
true;
5340 throw Exception(
"Error, StationEntryStopLinkPos not -1 for unnamed element at TrackVectorPosition = " + AnsiString(x));
5349 throw Exception(
"ConnError in LinkTrack - Final");
5353 throw Exception(
"ConnError in LinkTrack - Precheck");
5356 bool CLkErrorFlag =
false;
5358 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5362 CLkErrorFlag =
true;
5366 CLkErrorFlag =
true;
5370 CLkErrorFlag =
true;
5374 CLkErrorFlag =
true;
5382 throw Exception(
"CLkError in LinkTrack - Final");
5386 throw Exception(
"CLkError in LinkTrack - Precheck");
5390 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5419 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5435 for(
unsigned int y = 0; y < 4; y++)
5454 bool ConnectionFoundFlag =
false;
5456 if(ConnectionFoundFlag)
5460 bool LinkFoundFlag =
false;
5480 for(
unsigned int a = 0; a < 4; a++)
5489 LinkFoundFlag =
true;
5509 bool ConnErrorFlag =
false;
5511 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5515 ConnErrorFlag =
true;
5519 ConnErrorFlag =
true;
5523 ConnErrorFlag =
true;
5527 ConnErrorFlag =
true;
5535 bool CLkErrorFlag =
false;
5537 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5541 CLkErrorFlag =
true;
5545 CLkErrorFlag =
true;
5549 CLkErrorFlag =
true;
5553 CLkErrorFlag =
true;
5571 int Position1, Position2;
5577 for(GapMapPtr =
GapMap.begin(); GapMapPtr !=
GapMap.end(); GapMapPtr++)
5579 int HLoc1 = GapMapPtr->first.first;
5580 int VLoc1 = GapMapPtr->first.second;
5581 int HLoc2 = GapMapPtr->second.first;
5582 int VLoc2 = GapMapPtr->second.second;
5585 throw Exception(
"Failed to find H & V for gap1, GapMap in error");
5589 throw Exception(
"Failed to find H & V for gap2, GapMap in error");
5593 throw Exception(
"Element at Pos1 not a gap, GapMap in error");
5597 throw Exception(
"Element at Pos2 not a gap, GapMap in error");
5615 AnsiString(TrackElement.
VLoc) +
"," + AnsiString(TrackElement.
SpeedTag));
5616 THVPair TrackMapKeyPair, InactiveTrackMapKeyPair;
5626 bool FoundFlag =
false;
5638 InactiveTrackMapKeyPair.first = TrackElement.
HLoc;
5639 InactiveTrackMapKeyPair.second = TrackElement.
VLoc;
5640 InactiveTrackMapEntry.first = InactiveTrackMapKeyPair;
5669 bool FoundFlag =
false;
5682 TrackMapKeyPair.first = TrackElement.
HLoc;
5683 TrackMapKeyPair.second = TrackElement.
VLoc;
5684 TrackMapEntry.first = TrackMapKeyPair;
5689 LocationNameEntry.second = -(int)(
TrackVector.size());
5729 TrackMapKeyPair.first = HLoc;
5730 TrackMapKeyPair.second = VLoc;
5731 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
5741 return(TrackMapPtr->second);
5754 TrackMapKeyPair.first = HLoc;
5755 TrackMapKeyPair.second = VLoc;
5756 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
5759 AnsiString Message =
"Element not found at HLoc " + AnsiString(HLoc) +
" and VLoc " + AnsiString(VLoc);
5760 throw Exception(Message);
5778 MapKeyPair.first = HLoc;
5779 MapKeyPair.second = VLoc;
5780 MapPtr = Map.find(MapKeyPair);
5781 if(MapPtr == Map.end())
5783 AnsiString Message =
"Element not found at HLoc " + AnsiString(HLoc) +
" and VLoc " + AnsiString(VLoc) +
" in GetTrackElementFromAnyTrackMap";
5784 throw Exception(Message);
5789 return(Vector.at(MapPtr->second));
5799 THVPair InactiveTrackMapKeyPair;
5802 InactiveTrackMapKeyPair.first = HLoc;
5803 InactiveTrackMapKeyPair.second = VLoc;
5807 AnsiString Message =
"Inactive element not found at HLoc " + AnsiString(HLoc) +
" and VLoc " + AnsiString(VLoc);
5808 throw Exception(Message);
5822 bool Present =
true;
5826 TrackMapKeyPair.first = HLoc;
5827 TrackMapKeyPair.second = VLoc;
5828 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
5843 bool Present =
true;
5844 THVPair InactiveTrackMapKeyPair;
5847 InactiveTrackMapKeyPair.first = HLoc;
5848 InactiveTrackMapKeyPair.second = VLoc;
5866 THVPair InactiveTrackMapKeyPair;
5871 InactiveTrackMapKeyPair.first = HLoc;
5872 InactiveTrackMapKeyPair.second = VLoc;
5881 if(InactiveTrackRange.first == InactiveTrackRange.second)
5890 RetPair.first = InactiveTrackRange.first->second;
5891 RetPair.second = (--InactiveTrackRange.second)->second;
5904 AnsiString(DivergingPosition));
5915 if(((SpeedTag1 == 7) && (SpeedTag2 == 10)) ||
5916 ((SpeedTag1 == 10) && (SpeedTag2 == 7)) || ((SpeedTag1 == 8) && (SpeedTag2 == 9)) || ((SpeedTag1 == 9) && (SpeedTag2 == 8)) ||
5917 ((SpeedTag1 == 11) && (SpeedTag2 == 14)) ||
5918 ((SpeedTag1 == 14) && (SpeedTag2 == 11)) || ((SpeedTag1 == 12) && (SpeedTag2 == 13)) || ((SpeedTag1 == 13) && (SpeedTag2 == 12)) ||
5919 ((SpeedTag1 == 28) && (SpeedTag2 == 31)) ||
5920 ((SpeedTag1 == 31) && (SpeedTag2 == 28)) || ((SpeedTag1 == 29) && (SpeedTag2 == 30)) || ((SpeedTag1 == 30) && (SpeedTag2 == 29)) ||
5921 ((SpeedTag1 == 32) && (SpeedTag2 == 35)) ||
5922 ((SpeedTag1 == 35) && (SpeedTag2 == 32)) || ((SpeedTag1 == 33) && (SpeedTag2 == 34)) || ((SpeedTag1 == 34) && (SpeedTag2 == 33)) ||
5923 ((SpeedTag1 == 36) && (SpeedTag2 == 39)) ||
5924 ((SpeedTag1 == 39) && (SpeedTag2 == 36)) || ((SpeedTag1 == 37) && (SpeedTag2 == 38)) || ((SpeedTag1 == 38) && (SpeedTag2 == 37)) ||
5925 ((SpeedTag1 == 40) && (SpeedTag2 == 43)) ||
5926 ((SpeedTag1 == 43) && (SpeedTag2 == 40)) || ((SpeedTag1 == 41) && (SpeedTag2 == 42)) || ((SpeedTag1 == 42) && (SpeedTag2 == 41)))
5960 throw Exception(
"Error, Wrong track type in PlotGap");
5962 if((TrackElement.
SpeedTag == 88) && (TrackElement.
Conn[0] > -1))
5966 else if((TrackElement.
SpeedTag == 88) && (TrackElement.
Conn[0] == -1))
5970 if((TrackElement.
SpeedTag == 89) && (TrackElement.
Conn[0] > -1))
5974 else if((TrackElement.
SpeedTag == 89) && (TrackElement.
Conn[0] == -1))
5978 if((TrackElement.
SpeedTag == 90) && (TrackElement.
Conn[0] > -1))
5982 else if((TrackElement.
SpeedTag == 90) && (TrackElement.
Conn[0] == -1))
5986 if((TrackElement.
SpeedTag == 91) && (TrackElement.
Conn[0] > -1))
5990 else if((TrackElement.
SpeedTag == 91) && (TrackElement.
Conn[0] == -1))
5994 if((TrackElement.
SpeedTag == 92) && (TrackElement.
Conn[0] > -1))
5998 else if((TrackElement.
SpeedTag == 92) && (TrackElement.
Conn[0] == -1))
6002 if((TrackElement.
SpeedTag == 93) && (TrackElement.
Conn[0] > -1))
6006 else if((TrackElement.
SpeedTag == 93) && (TrackElement.
Conn[0] == -1))
6010 if((TrackElement.
SpeedTag == 94) && (TrackElement.
Conn[0] > -1))
6014 else if((TrackElement.
SpeedTag == 94) && (TrackElement.
Conn[0] == -1))
6018 if((TrackElement.
SpeedTag == 95) && (TrackElement.
Conn[0] > -1))
6022 else if((TrackElement.
SpeedTag == 95) && (TrackElement.
Conn[0] == -1))
6038 PosPair.first = TrackElement.
HLoc;
6039 PosPair.second = TrackElement.
VLoc;
6043 Disp->
PlotOutput(283, TrackElement.
HLoc * 16, TrackElement.
VLoc * 16, MOMIt->second);
6056 throw Exception(
"Error, Wrong track type in PlotPoints");
6067 else if(TrackElement.
SpeedTag < 132)
6078 else if(!TrackElement.
Failed)
6085 else if(TrackElement.
SpeedTag < 132)
6103 else if(TrackElement.
SpeedTag < 132)
6137 throw Exception(
"Error, Wrong track type in PlotSignal");
6141 for(
int x = 0; x < 40; x++)
6212 for(
int x = 0; x < 40; x++)
6219 Graphics::TBitmap* SignalPlatformGraphic;
6232 for(
int x = 0; x < 8; x++)
6322 while(
IsLCAtHV(0, HLoc, (VLoc + UpStep)))
6330 while(
IsLCAtHV(1, HLoc, (VLoc + DownStep)))
6338 while(
IsLCAtHV(2, (HLoc + LeftStep), VLoc))
6346 while(
IsLCAtHV(3, (HLoc + RightStep), VLoc))
6362 while(
IsLCAtHV(51, HLoc, (VLoc + UpStep)))
6370 while(
IsLCAtHV(52, HLoc, (VLoc + DownStep)))
6378 while(
IsLCAtHV(53, (HLoc + LeftStep), VLoc))
6386 while(
IsLCAtHV(54, (HLoc + RightStep), VLoc))
6419 while(
IsLCAtHV(55, HLoc, (VLoc + UpStep)))
6431 while(
IsLCAtHV(56, HLoc, (VLoc + DownStep)))
6443 while(
IsLCAtHV(57, (HLoc + LeftStep), VLoc))
6455 while(
IsLCAtHV(58, (HLoc + RightStep), VLoc))
6497 throw Exception(
"Error, Wrong track type in PlotAndLowerLevelCrossingBarriers");
6499 if((BaseElementSpeedTag != 1) && (BaseElementSpeedTag != 2))
6501 throw Exception(
"Error, Wrong BaseElementSpeedTag value in PlotAndLowerLevelCrossingBarriers");
6504 if(BaseElementSpeedTag == 1)
6508 while(
IsLCAtHV(5, HLoc, (VLoc + UpStep)))
6515 while(
IsLCAtHV(6, HLoc, (VLoc + DownStep)))
6523 Graphics::TBitmap *RouteGraphic;
6525 if(TypeOfRoute == 1)
6529 else if(TypeOfRoute == 0)
6535 RouteGraphic = BaseGraphic;
6542 if(UpStep == DownStep)
6545 Disp->
PlotOutput(133, HLoc * 16, VLoc * 16, RouteGraphic);
6555 else if((DownStep - UpStep) == 1)
6560 Disp->
PlotOutput(136, HLoc * 16, (VLoc + UpStep) * 16, RouteGraphic);
6570 Disp->
PlotOutput(139, HLoc * 16, (VLoc + DownStep) * 16, BaseGraphic);
6583 Disp->
PlotOutput(196, HLoc * 16, (VLoc + UpStep) * 16, BaseGraphic);
6593 Disp->
PlotOutput(199, HLoc * 16, (VLoc + DownStep) * 16, RouteGraphic);
6609 Disp->
PlotOutput(142, HLoc * 16, (VLoc + UpStep) * 16, RouteGraphic);
6619 Disp->
PlotOutput(145, HLoc * 16, (VLoc + DownStep) * 16, BaseGraphic);
6629 else if(DownStep == 0)
6632 Disp->
PlotOutput(202, HLoc * 16, (VLoc + UpStep) * 16, BaseGraphic);
6642 Disp->
PlotOutput(205, HLoc * 16, (VLoc + DownStep) * 16, RouteGraphic);
6655 Disp->
PlotOutput(208, HLoc * 16, (VLoc + UpStep) * 16, BaseGraphic);
6665 Disp->
PlotOutput(211, HLoc * 16, (VLoc + DownStep) * 16, BaseGraphic);
6675 for(
int x = (UpStep + 1); x < DownStep; x++)
6680 Disp->
PlotOutput(148, HLoc * 16, (VLoc + x) * 16, RouteGraphic);
6684 Disp->
PlotOutput(213, HLoc * 16, (VLoc + x) * 16, BaseGraphic);
6705 while(
IsLCAtHV(7, (HLoc + LStep), VLoc))
6712 while(
IsLCAtHV(8, (HLoc + RStep), VLoc))
6718 Graphics::TBitmap *RouteGraphic;
6720 if(TypeOfRoute == 1)
6724 else if(TypeOfRoute == 0)
6730 RouteGraphic = BaseGraphic;
6739 Disp->
PlotOutput(151, HLoc * 16, VLoc * 16, RouteGraphic);
6749 else if((RStep - LStep) == 1)
6754 Disp->
PlotOutput(154, (HLoc + LStep) * 16, VLoc * 16, RouteGraphic);
6764 Disp->
PlotOutput(157, (HLoc + RStep) * 16, VLoc * 16, BaseGraphic);
6777 Disp->
PlotOutput(215, (HLoc + LStep) * 16, VLoc * 16, BaseGraphic);
6787 Disp->
PlotOutput(218, (HLoc + RStep) * 16, VLoc * 16, RouteGraphic);
6803 Disp->
PlotOutput(160, (HLoc + LStep) * 16, VLoc * 16, RouteGraphic);
6813 Disp->
PlotOutput(163, (HLoc + RStep) * 16, VLoc * 16, BaseGraphic);
6826 Disp->
PlotOutput(221, (HLoc + LStep) * 16, VLoc * 16, BaseGraphic);
6836 Disp->
PlotOutput(224, (HLoc + RStep) * 16, VLoc * 16, RouteGraphic);
6849 Disp->
PlotOutput(227, (HLoc + LStep) * 16, VLoc * 16, BaseGraphic);
6859 Disp->
PlotOutput(230, (HLoc + RStep) * 16, VLoc * 16, BaseGraphic);
6869 for(
int x = (LStep + 1); x < RStep; x++)
6874 Disp->
PlotOutput(166, (HLoc + x) * 16, VLoc * 16, RouteGraphic);
6878 Disp->
PlotOutput(232, (HLoc + x) * 16, VLoc * 16, BaseGraphic);
6902 AnsiString(HLoc) +
"," + AnsiString(VLoc));
6905 throw Exception(
"Error, Wrong track type in PlotPlainLoweredLinkedLevelCrossingBarriersAndSetMarkers");
6907 if((BaseElementSpeedTag != 1) && (BaseElementSpeedTag != 2))
6909 throw Exception(
"Error, Wrong BaseElementSpeedTag value in PlotPlainLoweredLinkedLevelCrossingBarriersAndSetMarkers");
6912 if(BaseElementSpeedTag == 1)
6916 while(
IsLCAtHV(30, HLoc, (VLoc + UpStep)))
6923 while(
IsLCAtHV(31, HLoc, (VLoc + DownStep)))
6929 if(UpStep == DownStep)
6940 else if((DownStep - UpStep) == 1)
6959 for(
int x = (UpStep + 1); x < DownStep; x++)
6968 for(
int x = (UpStep + 1); x < DownStep; x++)
6975 for(
int x = UpStep; x <= DownStep; x++)
6988 while(
IsLCAtHV(32, (HLoc + LStep), VLoc))
6995 while(
IsLCAtHV(33, (HLoc + RStep), VLoc))
7012 else if((RStep - LStep) == 1)
7031 for(
int x = (LStep + 1); x < RStep; x++)
7040 for(
int x = (LStep + 1); x < RStep; x++)
7047 for(
int x = LStep; x <= RStep; x++)
7066 throw Exception(
"Error, Wrong track type in PlotAndRaiseLevelCrossingBarriers");
7068 if((BaseElementSpeedTag != 1) && (BaseElementSpeedTag != 2))
7070 throw Exception(
"Error, Wrong BaseElementSpeedTag value in PlotAndRaiseLevelCrossingBarriers");
7073 if(BaseElementSpeedTag == 1)
7077 while(
IsLCAtHV(10, HLoc, (VLoc + UpStep)))
7084 while(
IsLCAtHV(11, HLoc, (VLoc + DownStep)))
7090 for(
int x = UpStep; x < (DownStep + 1); x++)
7105 while(
IsLCAtHV(12, (HLoc + LStep), VLoc))
7112 while(
IsLCAtHV(13, (HLoc + RStep), VLoc))
7118 for(
int x = LStep; x < (RStep + 1); x++)
7137 AnsiString(HLoc) +
"," + AnsiString(VLoc));
7140 throw Exception(
"Error, Wrong track type in PlotPlainRaisedLinkedLevelCrossingBarriersAndSetMarkers");
7142 if((BaseElementSpeedTag != 1) && (BaseElementSpeedTag != 2))
7144 throw Exception(
"Error, Wrong BaseElementSpeedTag value in PlotPlainRaisedLinkedLevelCrossingBarriersAndSetMarkers");
7149 if(BaseElementSpeedTag == 1)
7153 while(
IsLCAtHV(35, HLoc, (VLoc + UpStep)))
7160 while(
IsLCAtHV(36, HLoc, (VLoc + DownStep)))
7166 for(
int x = UpStep; x <= DownStep; x++)
7180 while(
IsLCAtHV(37, (HLoc + LStep), VLoc))
7187 while(
IsLCAtHV(38, (HLoc + RStep), VLoc))
7193 for(
int x = LStep; x <= RStep; x++)
7209 Graphics::TBitmap *RouteGraphic;
7212 if(BaseElementSpeedTag == 1)
7214 if(TypeOfRoute == 1)
7218 else if(TypeOfRoute == 0)
7224 RouteGraphic = BaseGraphic;
7228 RouteGraphic = BaseGraphic;
7234 if(TypeOfRoute == 1)
7238 else if(TypeOfRoute == 0)
7244 RouteGraphic = BaseGraphic;
7248 RouteGraphic = BaseGraphic;
7253 while(
IsLCAtHV(14, HLoc, (VLoc + UpStep)))
7258 Disp->
PlotOutput(175, HLoc * 16, (VLoc + UpStep) * 16, RouteGraphic);
7262 Disp->
PlotOutput(234, HLoc * 16, (VLoc + UpStep) * 16, BaseGraphic);
7269 while(
IsLCAtHV(15, HLoc, (VLoc + DownStep)))
7272 Disp->
PlotOutput(177, HLoc * 16, (VLoc + DownStep) * 16, BaseGraphic);
7277 while(
IsLCAtHV(16, (HLoc + LeftStep), VLoc))
7282 Disp->
PlotOutput(235, (HLoc + LeftStep) * 16, VLoc * 16, RouteGraphic);
7286 Disp->
PlotOutput(236, (HLoc + LeftStep) * 16, VLoc * 16, BaseGraphic);
7293 while(
IsLCAtHV(17, (HLoc + RightStep), VLoc))
7296 Disp->
PlotOutput(238, (HLoc + RightStep) * 16, VLoc * 16, BaseGraphic);
7421 throw Exception(
"Element not found in LowerLCBarriersAtHV " + AnsiString(HLoc) +
"," + AnsiString(VLoc));
7425 throw Exception(
"Element not a level crossing in LowerLCBarriersAtHV " + AnsiString(HLoc) +
"," + AnsiString(VLoc));
7456 "," + AnsiString(VLoc));
7460 int DummyRouteNumber;
7462 TrainPresent =
false;
7466 while(
IsLCAtHV(25, HLoc, (VLoc + UpStep)))
7468 TrackMapKeyPair.first = HLoc;
7469 TrackMapKeyPair.second = VLoc + UpStep;
7470 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
7479 TrainPresent =
true;
7493 while(
IsLCAtHV(26, HLoc, (VLoc + DownStep)))
7495 TrackMapKeyPair.first = HLoc;
7496 TrackMapKeyPair.second = VLoc + DownStep;
7497 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
7506 TrainPresent =
true;
7520 while(
IsLCAtHV(27, (HLoc + LeftStep), VLoc))
7522 TrackMapKeyPair.first = HLoc + LeftStep;
7523 TrackMapKeyPair.second = VLoc;
7524 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
7533 TrainPresent =
true;
7547 while(
IsLCAtHV(28, (HLoc + RightStep), VLoc))
7549 TrackMapKeyPair.first = HLoc + RightStep;
7550 TrackMapKeyPair.second = VLoc;
7551 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
7560 TrainPresent =
true;
7580 for(
unsigned int x = 0; x < SearchVector.size(); x++)
7597 AnsiString(HLoc) +
"," + AnsiString(VLoc));
7600 throw Exception(
"PlotSmallFlashingLinkedLevelCrossings");
7606 while(
IsLCAtHV(61, HLoc, (VLoc + UpStep)))
7613 while(
IsLCAtHV(62, HLoc, (VLoc + DownStep)))
7619 for(
int x = UpStep; x <= DownStep; x++)
7626 while(
IsLCAtHV(63, (HLoc + LStep), VLoc))
7633 while(
IsLCAtHV(64, (HLoc + RStep), VLoc))
7639 for(
int x = LStep; x <= RStep; x++)
7655 throw Exception(
"Error, Wrong track type in GetFilletGraphic");
7662 else if(TrackElement.
SpeedTag < 132)
7680 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
7697 AnsiString(ScreenPosV));
7712 AnsiString(ScreenPosV));
7723 AnsiString(VPosTrue));
7737 for(
unsigned int a = 0; a <
TrackVector.size(); a++)
7749 throw Exception(
"CheckMapAndTrack Error - failed to find HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" + (AnsiString)CheckElement.
VLoc +
7750 " in TrackMap, Caller=" + (AnsiString)Caller);
7752 if(MapVecPos != (
int)a)
7754 throw Exception(
"CheckMapAndTrack Error - MapVectorPosition failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
7755 (AnsiString)CheckElement.
VLoc +
" Map value=" + (AnsiString)MapVecPos +
" TrackVectorPos value=" + (AnsiString)a +
" Caller=" +
7756 (AnsiString)Caller);
7762 throw Exception(
"CheckMapAndTrack Error - Map Size=" + (AnsiString)
TrackVector.size() +
" TrackVectorSize=" + (AnsiString)
TrackVector.size() +
7763 " Caller=" + (AnsiString)Caller);
7783 throw Exception(
"CheckMapAndInactiveTrack Error - failed to find HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" + (AnsiString)CheckElement.
VLoc +
7784 " in InactiveMap, Caller=" + (AnsiString)Caller);
7786 if((InactivePair.first != a) && (InactivePair.second != a))
7788 throw Exception(
"CheckMapAndInactiveTrack Error - InactiveMapVectorPosition failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
7789 (AnsiString)CheckElement.
VLoc +
" Inactive Map values=" + (AnsiString)InactivePair.first +
" and " + (AnsiString)InactivePair.second +
7790 " InactiveTrackVectorPos value=" + (AnsiString)a +
" Caller=" + (AnsiString)Caller);
7795 throw Exception(
"CheckMapAndInactiveTrack Error - Map Size=" + (AnsiString)
TrackVector.size() +
" TrackVectorSize=" + (AnsiString)
TrackVector.size() +
7796 " Caller=" + (AnsiString)Caller);
7806 int Position1, Position2;
7812 for(GapMapPtr =
GapMap.begin(); GapMapPtr !=
GapMap.end(); GapMapPtr++)
7814 int HLoc1 = GapMapPtr->first.first;
7815 int VLoc1 = GapMapPtr->first.second;
7816 int HLoc2 = GapMapPtr->second.first;
7817 int VLoc2 = GapMapPtr->second.second;
7820 throw Exception(
"Failed to find H & V for gap1, GapMap in error");
7824 throw Exception(
"Failed to find H & V for gap2, GapMap in error");
7828 throw Exception(
"Element at Pos1 not a gap, GapMap in error");
7832 throw Exception(
"Element at Pos2 not a gap, GapMap in error");
7836 unsigned int GapCount = 0;
7838 for(
unsigned int a = 0; a <
TrackVector.size(); a++)
7846 if((
GapMap.size() * 2) != GapCount)
7848 throw Exception(
"GapMap Error - Map Size * 2 =" + (AnsiString)(
GapMap.size() * 2) +
" GapCount=" + (AnsiString)GapCount +
" Caller=" +
7849 (AnsiString)Caller);
7859 if((TrackElement.
HLoc == -2000000000) || (TrackElement.
VLoc == -2000000000))
7863 throw Exception(
"Error - TrackFinished with erase element still present");
7868 AnsiString IDString;
7870 if(TrackElement.
HLoc < 0)
7872 IDString =
"N" + AnsiString(abs(TrackElement.
HLoc)) +
"-";
7876 IDString = AnsiString(TrackElement.
HLoc) +
"-";
7878 if(TrackElement.
VLoc < 0)
7880 IDString +=
"N" + AnsiString(abs(TrackElement.
VLoc));
7884 IDString += AnsiString(TrackElement.
VLoc);
7899 for(
int x = 1; x < String.Length() + 1; x++)
7901 if(String.IsDelimiter(
"-", x))
7906 if(x == String.Length())
7910 ShowMessage(
"Error in track element identifier: <" + String +
"> - no delimiter");
7920 ShowMessage(
"Error in track element identifier: <" + String +
"> - No Horizontal value");
7925 if(DelimPos == String.Length())
7929 ShowMessage(
"Error in track element identifier <" + String +
"> - No Vertical value");
7934 if((String[String.Length()] <
'0') || (String[String.Length()] >
'9'))
7938 ShowMessage(
"Error in track element identifier <" + String +
"> - Last value is not a number");
7945 if(String.SubString(1, 1) !=
"N")
7947 for(
int x = 1; x < DelimPos; x++)
7949 if((String.SubString(x, 1) <
"0") || (String.SubString(x, 1) >
"9"))
7953 ShowMessage(
"Invalid character in Horizontal value in track element identifier: <" + String +
">");
7960 if(String.SubString(1, 1) ==
"N")
7962 for(
int x = 2; x < DelimPos; x++)
7964 if((String.SubString(x, 1) <
"0") || (String.SubString(x, 1) >
"9"))
7968 ShowMessage(
"Invalid character in Horizontal value in track element identifier: <" + String +
">");
7975 if(String.SubString(1, 1) ==
"N")
7977 HLoc = -(String.SubString(2, DelimPos - 2).ToInt());
7981 HLoc = String.SubString(1, DelimPos - 1).ToInt();
7983 if(String.SubString(DelimPos + 1, 1) !=
"N")
7985 for(
int x = DelimPos + 1; x < String.Length() + 1; x++)
7987 if((String.SubString(x, 1) <
"0") || (String.SubString(x, 1) >
"9"))
7991 ShowMessage(
"Invalid character in Vertical value in track element identifier: <" + String +
">");
7998 if(String.SubString(DelimPos + 1, 1) ==
"N")
8000 for(
int x = DelimPos + 2; x < String.Length() + 1; x++)
8002 if((String.SubString(x, 1) <
"0") || (String.SubString(x, 1) >
"9"))
8006 ShowMessage(
"Invalid character in Vertical value in track element identifier: <" + String +
">");
8013 if(String.SubString(DelimPos + 1, 1) ==
"N")
8015 VLoc = -(String.SubString(DelimPos + 2, String.Length() - DelimPos - 1).ToInt());
8019 VLoc = String.SubString(DelimPos + 1, String.Length() - DelimPos).ToInt();
8024 TrackMapPtr =
TrackMap.find(HVPair);
8029 ShowMessage(
"No track element corresponding to track element identifier: <" + String +
">");
8035 return(TrackMapPtr->second);
8037 catch(
const Exception &e)
8040 ShowMessage(
"Syntax error in track element identifier: <" + String +
">");
8054 AnsiString(TrackElement.
VLoc) +
"," + AnsiString(TrackElement.
SpeedTag));
8055 int HLoc = TrackElement.
HLoc;
8056 int VLoc = TrackElement.
VLoc;
8159 AnsiString(SpeedTag));
8170 if(HVRange.first == HVRange.second)
8177 HVIt1 = HVRange.first;
8182 if(--HVRange.second != HVRange.first)
8184 HVIt2 = HVRange.second;
8188 HVIt2->second).
SpeedTag == SpeedTag)))
8208 AnsiString(SpeedTag));
8274 AnsiString TestString1, TestString2;
8279 throw Exception(
"LNPendingList size not 1 on entry");
8281 int CurrentElementNumber;
8287 int H = CurrentElement->HLoc;
8288 int V = CurrentElement->VLoc;
8289 int Tag = CurrentElement->SpeedTag;
8295 for(
int x = 0; x < 25; x++)
8305 for(
int x = 0; x < 25; x++)
8315 for(
int x = 0; x < 25; x++)
8325 for(
int x = 0; x < 25; x++)
8335 for(
int x = 0; x < 28; x++)
8345 for(
int x = 0; x < 8; x++)
8355 for(
int x = 0; x < 8; x++)
8365 for(
int x = 0; x < 4; x++)
8375 for(
int x = 0; x < 8; x++)
8385 for(
int x = 0; x < 8; x++)
8398 if(CurrentElementNumber > -1)
8403 if((ExistingName !=
"") && (ExistingName != LocationName))
8419 AddName(1, CurrentElement, LocationName);
8423 LNDone2MultiMapEntry.first = HVPair;
8434 bool FoundFlag, ErasedFlag =
false;
8436 if(SNRange.first != SNRange.second)
8440 for(SNIterator = SNRange.second; SNIterator != SNRange.first; SNIterator--)
8447 TVIt->LocationName =
"";
8448 TVIt->ActiveTrackElementName =
"";
8481 std::pair<AnsiString, char>TempMapPair;
8489 TempMapPair.second =
'x';
8507 AnsiString(SpeedTag));
8517 if((SpeedTag == 129) || (SpeedTag == 130) || (SpeedTag == 145) || (SpeedTag == 146))
8524 int MapPos = -1 - Position;
8528 FoundElement = MapPos;
8544 FoundElement = IMPair.first;
8553 FoundElement = IMPair.second;
8574 AnsiString OldName = TrackElement->LocationName, ErrorString;
8576 TrackElement->LocationName = Name;
8577 int HLoc = TrackElement->HLoc;
8578 int VLoc = TrackElement->VLoc;
8592 if(ErrorString !=
"")
8594 throw Exception(ErrorString +
" in AddName for OldName == " + OldName);
8618 if(LNDone2MultiMapIterator->second == MapPos)
8645 if(*LNPendingListIterator == MapPos)
8718 if(NameBeingChecked !=
"")
8724 ShowMessage(
"Please note that more than one instance of " + NameBeingChecked +
" was found. Location names must be unique before the railway can be saved as a .rly file");
8732 NameBeingChecked = LNMMRg.second->first;
8734 if(NameBeingChecked !=
"")
8740 ShowMessage(
"Please note that more than one instance of " + NameBeingChecked +
" was found. Location names must be unique before the railway can be saved as a .rly file");
8761 if(LNMMIt->second < 0)
8771 HVPairsLinkedMap.insert(std::pair<THVPair, bool>(HVPair,
false));
8779 std::list<THVPair> HVLinkedList;
8782 HVPairsLinkedMap.begin()->second =
true;
8783 HVLinkedList.push_back(HVPairsLinkedMap.begin()->first);
8786 THVPair HVPairUnderExamination;
8787 THVPairsLinkedMap::iterator HVPLMIt;
8789 while(!HVLinkedList.empty())
8791 HVPairUnderExamination = HVLinkedList.front();
8792 HVLinkedList.pop_front();
8793 HVPairNew.first = HVPairUnderExamination.first;
8794 HVPairNew.second = HVPairUnderExamination.second - 1;
8795 HVPLMIt = HVPairsLinkedMap.find(HVPairNew);
8796 if(HVPLMIt != HVPairsLinkedMap.end())
8798 if(!HVPLMIt->second)
8800 HVLinkedList.push_back(HVPLMIt->first);
8802 HVPLMIt->second =
true;
8804 HVPairNew.first = HVPairUnderExamination.first - 1;
8805 HVPairNew.second = HVPairUnderExamination.second;
8806 HVPLMIt = HVPairsLinkedMap.find(HVPairNew);
8807 if(HVPLMIt != HVPairsLinkedMap.end())
8809 if(!HVPLMIt->second)
8811 HVLinkedList.push_back(HVPLMIt->first);
8813 HVPLMIt->second =
true;
8815 HVPairNew.first = HVPairUnderExamination.first;
8816 HVPairNew.second = HVPairUnderExamination.second + 1;
8817 HVPLMIt = HVPairsLinkedMap.find(HVPairNew);
8818 if(HVPLMIt != HVPairsLinkedMap.end())
8820 if(!HVPLMIt->second)
8822 HVLinkedList.push_back(HVPLMIt->first);
8824 HVPLMIt->second =
true;
8826 HVPairNew.first = HVPairUnderExamination.first + 1;
8827 HVPairNew.second = HVPairUnderExamination.second;
8828 HVPLMIt = HVPairsLinkedMap.find(HVPairNew);
8829 if(HVPLMIt != HVPairsLinkedMap.end())
8831 if(!HVPLMIt->second)
8833 HVLinkedList.push_back(HVPLMIt->first);
8835 HVPLMIt->second =
true;
8840 for(THVPairsLinkedMap::iterator HVPLMIt = HVPairsLinkedMap.begin(); HVPLMIt != HVPairsLinkedMap.end(); HVPLMIt++)
8842 if(!HVPLMIt->second)
8861 if(LocationName ==
"")
8872 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
8879 ActiveTrackElementNameMapEntry.second = 0;
8901 bool FoundFlag, ErasedFlag =
false;
8905 if(SNRange.first != SNRange.second)
8908 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
8911 TVIt->LocationName =
"";
8912 TVIt->ActiveTrackElementName =
"";
8946 AnsiString(VLoc) +
"," + AnsiString(SpeedTag));
8948 AnsiString LocationName;
8957 if(LocationName !=
"")
8965 if(LocationName !=
"")
8979 if(LocationName !=
"")
8981 int ModifiedPosition = -1 - Position;
8990 for(
int x = 0; x < 25; x++)
9000 else if(SpeedTag == 77)
9002 for(
int x = 0; x < 25; x++)
9012 else if(SpeedTag == 78)
9014 for(
int x = 0; x < 25; x++)
9024 else if(SpeedTag == 79)
9026 for(
int x = 0; x < 25; x++)
9036 else if(SpeedTag == 96)
9038 for(
int x = 0; x < 28; x++)
9048 else if(SpeedTag == 129)
9050 for(
int x = 0; x < 8; x++)
9060 else if(SpeedTag == 130)
9062 for(
int x = 0; x < 8; x++)
9072 else if(SpeedTag == 145)
9074 for(
int x = 0; x < 8; x++)
9084 else if(SpeedTag == 146)
9086 for(
int x = 0; x < 8; x++)
9096 else if(SpeedTag == 131)
9098 for(
int x = 0; x < 4; x++)
9121 AnsiString(SpeedTag));
9133 if(TempElement->LocationName !=
"")
9135 LocationName = TempElement->LocationName;
9136 FoundElement = IMPair.first;
9144 if(TempElement->LocationName !=
"")
9146 LocationName = TempElement->LocationName;
9147 FoundElement = IMPair.second;
9159 if(TempElement->LocationName !=
"")
9161 LocationName = TempElement->LocationName;
9162 FoundElement = -1 - Position;
9178 unsigned int Count = 0;
9185 AnsiString SName, TName, ErrorString;
9187 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9193 throw Exception(
"Track element has FixedNamedLocationElement set but is not a footbridge/underpass in CheckLocationNameMultiMap, caller = " +
9194 AnsiString(Caller));
9207 (
"Inactive track element has FixedNamedLocationElement set but is not a platform, concourse or named location in CheckLocationNameMultiMap, caller = " +
9208 AnsiString(Caller));
9215 throw Exception(
"LocationNameMultiMap size = " + AnsiString(
LocationNameMultiMap.size()) +
" & Count = " + AnsiString(Count) +
9216 " in CheckLocationNameMultiMap, caller = " + AnsiString(Caller));
9221 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9227 if(ErrorString !=
"")
9229 throw Exception(ErrorString +
" in CheckLocationNameMultiMap for TrackVector check, caller = " + AnsiString(Caller));
9231 if(SNIt->second != -1 - (
int)x)
9233 throw Exception(
"Elements different in name map & TrackVector in CheckLocationNameMultiMap for TrackVector check, caller = " +
9234 AnsiString(Caller));
9240 bool FoundFlag =
false;
9249 throw Exception(
"Track element with ActiveTrackElementName but no plat/named loc at H " + AnsiString(
TrackElementAt(1369, x).HLoc) +
" & V " +
9250 AnsiString(
TrackElementAt(1370, x).VLoc) +
" in CheckLocationNameMultiMap, caller = " + AnsiString(Caller));
9254 throw Exception(
"Track element with ActiveTrackElementName " + TName +
" but plat/named loc at H " + AnsiString(
TrackElementAt(1371, x).HLoc) +
9255 " & V " + AnsiString(
TrackElementAt(1372, x).VLoc) +
" has different LocationName in CheckLocationNameMultiMap, caller = " +
9256 AnsiString(Caller));
9261 throw Exception(
"Track element with ActiveTrackElementName but no inactive element at H " + AnsiString(
TrackElementAt(1373, x).HLoc) +
" & V " +
9262 AnsiString(
TrackElementAt(1374, x).VLoc) +
" in CheckLocationNameMultiMap, caller = " + AnsiString(Caller));
9272 if(ErrorString !=
"")
9274 throw Exception(ErrorString +
" in CheckLocationNameMultiMap for InactiveTrackVector check, caller = " + AnsiString(Caller));
9276 if(SNIt->second != (
int)x)
9278 throw Exception(
"Elements different in name map & TrackVector in CheckLocationNameMultiMap for TrackVector check, caller = " +
9279 AnsiString(Caller));
9289 AnsiString &ErrorString)
9297 AnsiString(TrackElement->HLoc) +
"," + AnsiString(TrackElement->VLoc) +
"," + AnsiString(TrackElement->SpeedTag));
9299 bool FoundFlag =
false;
9303 if(SNRange.first == SNRange.second)
9305 ErrorString =
"Error, Name " + LocationName +
" not found in map";
9307 return(SNRange.first);
9311 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
9313 if(SNIterator->second < 0)
9315 int TVPos = -1 - SNIterator->second;
9317 if(TVIt == TrackElement)
9326 int ITVPos = SNIterator->second;
9328 if(ITVIt == TrackElement)
9339 ErrorString =
"Error, Name " + LocationName +
" found but not at required element";
9356 LocationNameEntry.first = NewName;
9357 LocationNameEntry.second = SNIterator->second;
9371 int TruePos = -1 - Position;
9375 throw Exception(
"Footbridge/underpass error in GetTrackVectorIteratorFromNamePosition, caller = " + AnsiString(Caller));
9385 throw Exception(
"Inactive element error in GetTrackVectorIteratorFromNamePosition, caller = " + AnsiString(Caller));
9408 InactiveTrack2MultiMapIterator++)
9410 if(InactiveTrack2MultiMapIterator->second > VecPos)
9412 InactiveTrack2MultiMapIterator->second--;
9420 LocationNameMultiMapIterator++)
9422 if(LocationNameMultiMapIterator->second < 0)
9426 if(LocationNameMultiMapIterator->second > (
int)VecPos)
9428 LocationNameMultiMapIterator->second--;
9450 for(TrackMapIterator =
TrackMap.begin(); TrackMapIterator !=
TrackMap.end(); TrackMapIterator++)
9452 if(TrackMapIterator->second > VecPos)
9454 TrackMapIterator->second--;
9462 LocationNameMultiMapIterator++)
9464 if(LocationNameMultiMapIterator->second >= 0)
9470 if(LocationNameMultiMapIterator->second < -(
int)(VecPos + 1))
9472 LocationNameMultiMapIterator->second++;
9476 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9482 if(TkEl.
Conn[0] ==
int(VecPos))
9487 if(TkEl.
Conn[0] >
int(VecPos))
9491 if(TkEl.
Conn[0] > -1)
9517 for(
unsigned int TVPos = 0; TVPos <
TrackVector.size(); TVPos++)
9523 LocationNameEntry.second = -1 - TVPos;
9534 LocationNameEntry.second = ITVPos;
9576 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9608 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9636 AnsiString((
short)FirstTrack));
9637 bool LengthDifferent =
false, SpeedDifferent =
false;
9644 int EXArray[16][2] =
9646 {2, 4}, {6, 2}, {8, 6}, {4, 8},
9647 {1, 6}, {3, 8}, {9, 4}, {7, 2}, {1, 8}, {3, 4}, {9, 2}, {7, 6},
9650 int Index = -1, BrNum = -1, GrNum = -1, InLink, OutLink;
9651 Graphics::TBitmap *Bitmap;
9655 InLink = TrackElement.
Link[0];
9656 OutLink = TrackElement.
Link[1];
9660 InLink = TrackElement.
Link[2];
9661 OutLink = TrackElement.
Link[3];
9663 for(
int x = 0; x < 16; x++)
9665 if((InLink == EXArray[x][0] && OutLink == EXArray[x][1]) || (InLink == EXArray[x][1] && OutLink == EXArray[x][0]))
9672 throw Exception(
"Error, failed to find Index in TTrack::MarkOneLength");
9691 else if(TrackElement.
SpeedTag == 54)
9695 else if(TrackElement.
SpeedTag == 55)
9706 else if(TrackElement.
SpeedTag == 58)
9710 else if(TrackElement.
SpeedTag == 59)
9715 else if(Index == 14)
9721 else if(TrackElement.
SpeedTag == 52)
9725 else if(TrackElement.
SpeedTag == 57)
9730 else if(Index == 15)
9736 else if(TrackElement.
SpeedTag == 53)
9740 else if(TrackElement.
SpeedTag == 56)
9754 if(LengthDifferent && SpeedDifferent)
9822 else if(LengthDifferent && !SpeedDifferent)
9969 AnsiString((
short)FirstTrack));
9970 LengthDifferent =
false;
9971 SpeedDifferent =
false;
9976 LengthDifferent =
true;
9980 SpeedDifferent =
true;
9982 if(LengthDifferent || SpeedDifferent)
9995 LengthDifferent =
true;
9999 SpeedDifferent =
true;
10001 if(LengthDifferent || SpeedDifferent)
10014 LengthDifferent =
true;
10018 SpeedDifferent =
true;
10020 if(LengthDifferent || SpeedDifferent)
10100 AnsiString TempName;
10101 int VecPos, StartVecPos, Count, EntryPos, StartEntryPos, ForwardNumber, ReverseNumber;
10102 bool ForwardSet, ReverseSet;
10104 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
10109 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
10111 ForwardSet =
false;
10112 ReverseSet =
false;
10147 for(
int y = 0; y < 2; y++)
10178 StartElement = TempElement;
10179 StartVecPos = VecPos;
10182 EntryPos = 1 - Dir;
10183 StartEntryPos = 1 - Dir;
10192 VecPos = TempElement.
Conn[1 - EntryPos];
10193 int TempEntryPos = TempElement.
ConnLinkPos[1 - EntryPos];
10195 EntryPos = TempEntryPos;
10223 ForwardNumber = ((Count + 1) / 2) + 1;
10224 ReverseNumber = (Count - ForwardNumber) + 1;
10226 EntryPos = 1 - Dir;
10227 TempElement = StartElement;
10228 VecPos = StartVecPos;
10229 if(Count == ForwardNumber)
10234 if(Count == ReverseNumber)
10242 VecPos = TempElement.
Conn[1 - EntryPos];
10243 int TempEntryPos = TempElement.
ConnLinkPos[1 - EntryPos];
10245 EntryPos = TempEntryPos;
10247 if(Count == ForwardNumber)
10252 if(Count == ReverseNumber)
10264 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
10400 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
10456 if((TextH / 16) - 1 <
HLocMin)
10460 if((TextH / 16) + 1 >
HLocMax)
10464 if((TextV / 16) - 1 <
VLocMin)
10468 if((TextV / 16) + 1 >
VLocMax)
10498 void TTrack::UserGraphicMove(
int Caller,
int HPosInput,
int VPosInput,
int &UserGraphicItem,
int &UserGraphicMoveHPos,
int &UserGraphicMoveVPos,
10499 bool &UserGraphicFoundFlag)
10502 TUserGraphicVector::iterator UserGraphicPtr;
10504 UserGraphicFoundFlag =
false;
10511 if((HPosInput >= (*UserGraphicPtr).HPos) && (HPosInput < ((*UserGraphicPtr).HPos + (*UserGraphicPtr).Width)) && (VPosInput >=
10512 (*UserGraphicPtr).VPos) && (VPosInput < ((*UserGraphicPtr).VPos + (*UserGraphicPtr).Height)))
10514 UserGraphicItem = x;
10515 UserGraphicMoveHPos = (*UserGraphicPtr).HPos;
10516 UserGraphicMoveVPos = (*UserGraphicPtr).VPos;
10517 UserGraphicFoundFlag =
true;
10535 int SpeedTag = TrackElement.
SpeedTag;
10539 throw Exception(
"Error - SpeedTag value " + AnsiString(SpeedTag) +
" in RetrieveStripedNamedLocationGraphicsWhereRelevant");
10588 return(GraphicOutput);
10596 if((At < 0) || ((
unsigned int)At >=
TrackVector.size()))
10599 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
TrackVector.size()) +
", At: " + AnsiString(At) +
" in TrackElementAt");
10612 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
InactiveTrackVector.size()) +
", At: " + AnsiString(At) +
10613 " in InactiveTrackElementAt");
10624 if((At < 0) || ((
unsigned int)At >=
TrackVector.size()))
10626 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
TrackVector.size()) +
", At: " + AnsiString(At) +
" in BlankElementAt");
10651 TTrackElement InactiveElement, FirstNamedElement, SecondNamedElement, FirstNamedLinkedElement, SecondNamedLinkedElement;
10652 int FirstNamedExitPos, SecondNamedExitPos, FirstNamedLinkedExitPos, SecondNamedLinkedEntryPos;
10656 if(SNRange.first == SNRange.second)
10661 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
10663 if(SNIterator->second < 0)
10677 HVPair.first = InactiveElement.
HLoc;
10678 HVPair.second = InactiveElement.
VLoc;
10682 (
"Error - failed to find element in TrackMap for a non-concourse element in LocationNameMultiMap in OneNamedLocationLongEnoughForSplit (1)");
10684 int TVPos =
TrackMap.find(HVPair)->second;
10687 if((FirstNamedElement.
Conn[0] == -1) || (FirstNamedElement.
Conn[1] == -1))
10693 FirstNamedExitPos = 0;
10695 SecondNamedElement =
TrackElementAt(561, FirstNamedElement.
Conn[FirstNamedExitPos]);
10697 FirstNamedLinkedElement =
TrackElementAt(562, FirstNamedElement.
Conn[1 - FirstNamedExitPos]);
10698 FirstNamedLinkedExitPos = FirstNamedElement.
ConnLinkPos[1 - FirstNamedExitPos];
10701 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
10703 SecondNamedLinkedElement =
TrackElementAt(563, SecondNamedElement.
Conn[SecondNamedExitPos]);
10704 SecondNamedLinkedEntryPos = SecondNamedElement.
ConnLinkPos[SecondNamedExitPos];
10705 if((SecondNamedLinkedElement.
TrackType !=
Points) || (SecondNamedLinkedEntryPos != 3))
10708 if((FirstNamedLinkedElement.
TrackType !=
Points) || (FirstNamedLinkedExitPos != 3))
10718 FirstNamedExitPos = 1;
10720 SecondNamedElement =
TrackElementAt(564, FirstNamedElement.
Conn[FirstNamedExitPos]);
10722 FirstNamedLinkedElement =
TrackElementAt(565, FirstNamedElement.
Conn[1 - FirstNamedExitPos]);
10723 FirstNamedLinkedExitPos = FirstNamedElement.
ConnLinkPos[1 - FirstNamedExitPos];
10726 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
10728 SecondNamedLinkedElement =
TrackElementAt(566, SecondNamedElement.
Conn[SecondNamedExitPos]);
10729 SecondNamedLinkedEntryPos = SecondNamedElement.
ConnLinkPos[SecondNamedExitPos];
10730 if((SecondNamedLinkedElement.
TrackType !=
Points) || (SecondNamedLinkedEntryPos != 3))
10733 if((FirstNamedLinkedElement.
TrackType !=
Points) || (FirstNamedLinkedExitPos != 3))
10749 int &FirstNamedLinkedElementPos,
int &SecondNamedLinkedElementPos)
10763 AnsiString(FirstNamedElementPos));
10764 TTrackElement InactiveElement, FirstNamedElement, SecondNamedElement, FirstNamedLinkedElement, SecondNamedLinkedElement;
10765 int FirstNamedExitPos, SecondNamedExitPos, FirstNamedLinkedExitPos, SecondNamedLinkedEntryPos;
10767 SecondNamedElementPos = -1;
10768 FirstNamedLinkedElementPos = -1;
10769 SecondNamedLinkedElementPos = -1;
10773 if(SNRange.first == SNRange.second)
10778 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
10780 if(SNIterator->second < 0)
10790 HVPair.first = InactiveElement.
HLoc;
10791 HVPair.second = InactiveElement.
VLoc;
10803 (
"Error - failed to find element in TrackMap for a non-concourse element in LocationNameMultiMap in ThisNamedLocationLongEnoughForSplit (2)"
10807 int TVPos =
TrackMap.find(HVPair)->second;
10808 if(TVPos != FirstNamedElementPos)
10814 if((FirstNamedElement.
Conn[0] == -1) || (FirstNamedElement.
Conn[1] == -1))
10820 FirstNamedExitPos = 0;
10822 SecondNamedElement =
TrackElementAt(568, FirstNamedElement.
Conn[FirstNamedExitPos]);
10824 FirstNamedLinkedElement =
TrackElementAt(569, FirstNamedElement.
Conn[1 - FirstNamedExitPos]);
10825 FirstNamedLinkedExitPos = FirstNamedElement.
ConnLinkPos[1 - FirstNamedExitPos];
10828 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
10830 SecondNamedLinkedElement =
TrackElementAt(570, SecondNamedElement.
Conn[SecondNamedExitPos]);
10831 SecondNamedLinkedEntryPos = SecondNamedElement.
ConnLinkPos[SecondNamedExitPos];
10832 if((SecondNamedLinkedElement.
TrackType !=
Points) || (SecondNamedLinkedEntryPos != 3))
10835 if((FirstNamedLinkedElement.
TrackType !=
Points) || (FirstNamedLinkedExitPos != 3))
10837 SecondNamedElementPos = FirstNamedElement.
Conn[FirstNamedExitPos];
10838 FirstNamedLinkedElementPos = FirstNamedElement.
Conn[1 - FirstNamedExitPos];
10839 SecondNamedLinkedElementPos = SecondNamedElement.
Conn[SecondNamedExitPos];
10848 FirstNamedExitPos = 1;
10850 SecondNamedElement =
TrackElementAt(571, FirstNamedElement.
Conn[FirstNamedExitPos]);
10852 FirstNamedLinkedElement =
TrackElementAt(572, FirstNamedElement.
Conn[1 - FirstNamedExitPos]);
10853 FirstNamedLinkedExitPos = FirstNamedElement.
ConnLinkPos[1 - FirstNamedExitPos];
10856 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
10858 SecondNamedLinkedElement =
TrackElementAt(573, SecondNamedElement.
Conn[SecondNamedExitPos]);
10859 SecondNamedLinkedEntryPos = SecondNamedElement.
ConnLinkPos[SecondNamedExitPos];
10860 if((SecondNamedLinkedElement.
TrackType !=
Points) || (SecondNamedLinkedEntryPos != 3))
10863 if((FirstNamedLinkedElement.
TrackType !=
Points) || (FirstNamedLinkedExitPos != 3))
10865 SecondNamedElementPos = FirstNamedElement.
Conn[FirstNamedExitPos];
10866 FirstNamedLinkedElementPos = FirstNamedElement.
Conn[1 - FirstNamedExitPos];
10867 SecondNamedLinkedElementPos = SecondNamedElement.
Conn[SecondNamedExitPos];
10888 if(SNRange.first != SNRange.second)
10890 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
10892 if(SNIterator->second < 0)
10914 "," + AnsiString(SpeedTag));
10925 throw Exception(
"Error, FoundFlag false in PlatformOnSignalSide after IsPlatformOrNamedNonStationLocationPresent called successfully");
10955 else if(SpeedTag == 69)
10981 else if(SpeedTag == 70)
11007 else if(SpeedTag == 71)
11044 AnsiString(NextEntryPos) +
"," + AnsiString(OwnTrainID));
11045 if(NextEntryPos < 0)
11058 if(NextEntryPos > 1)
11077 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
TrackVector.size()) +
", At: " + AnsiString(At) +
" in SelectVectorAt");
11089 AnsiString(VLocIn) +
"," + AnsiString(LinkIn));
11090 bool FoundFlag =
false;
11105 int VLocHi = -2000000000, VLocLo = 2000000000, HLoc = 2000000000;
11106 bool FoundFlag =
false;
11131 VPosHi = 16 * VLocHi;
11132 VPosLo = 16 * VLocLo;
11151 AnsiString(EndTVPosition));
11162 int Link0Squares = ((EndElement.
HLoc - NewHLocLink0) * (EndElement.
HLoc - NewHLocLink0)) +
11163 ((EndElement.
VLoc - NewVLocLink0) * (EndElement.
VLoc - NewVLocLink0));
11164 int Link1Squares = ((EndElement.
HLoc - NewHLocLink1) * (EndElement.
HLoc - NewHLocLink1)) +
11165 ((EndElement.
VLoc - NewVLocLink1) * (EndElement.
VLoc - NewVLocLink1));
11167 if(Link0Squares <= Link1Squares)
11185 AnsiString(LinkPos));
11204 if((LinkPos == 1) && (TE.
Attribute == 0))
11209 else if(LinkPos == 1)
11215 else if((LinkPos == 3) && (TE.
Attribute == 1))
11220 else if(LinkPos == 3)
11227 else if(LinkPos == 0)
11232 else if(LinkPos == 1)
11237 else if(LinkPos == 2)
11242 else if(LinkPos == 3)
11247 throw Exception(
"Error, failure in GetExitPos");
11296 if((TE.
Link[0] == Link) || (TE.
Link[1] == Link))
11300 else if((TE.
Link[2] == Link) || (TE.
Link[3] == Link))
11342 "," + AnsiString(DiagonalLinkNumber));
11347 if(((DiagonalLinkNumber == 1) &&
TrainOnLink(8, HLoc - 1, VLoc, 3, TrainID)) || ((DiagonalLinkNumber == 7) &&
TrainOnLink(9, HLoc - 1, VLoc, 9, TrainID)))
11352 if(((DiagonalLinkNumber == 1) &&
TrainOnLink(10, HLoc, VLoc - 1, 7, TrainID)) || ((DiagonalLinkNumber == 3) &&
TrainOnLink(11, HLoc, VLoc - 1, 9, TrainID)))
11357 if(((DiagonalLinkNumber == 3) &&
TrainOnLink(12, HLoc + 1, VLoc, 1, TrainID)) || ((DiagonalLinkNumber == 9) &&
TrainOnLink(13, HLoc + 1, VLoc, 7, TrainID)))
11362 if(((DiagonalLinkNumber == 7) &&
TrainOnLink(14, HLoc, VLoc + 1, 1, TrainID)) || ((DiagonalLinkNumber == 9) &&
TrainOnLink(15, HLoc, VLoc + 1, 3, TrainID)))
11378 AnsiString JustFileName =
"";
11383 int LastDelim = UGI.
FileName.LastDelimiter(
'\\');
11390 JustFileName = UGI.
FileName.SubString(LastDelim + 1, UGI.
FileName.Length() - LastDelim);
11409 typedef std::list<int> TNamePosList;
11410 TNamePosList NamePosList;
11411 typedef TNamePosList::iterator TNPLIt;
11413 typedef std::list<int> TOnePlatList;
11414 TOnePlatList OnePlatList;
11415 typedef TOnePlatList::iterator TOPLIt;
11418 NamePosList.clear();
11419 OnePlatList.clear();
11420 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
11422 if(
TrackElementAt(988, x).ActiveTrackElementName == LocationName)
11424 NamePosList.push_back(x);
11429 if(!NamePosList.empty())
11431 OnePlatList.push_back(NamePosList.back());
11432 NamePosList.pop_back();
11434 while(!OnePlatList.empty())
11436 TempInt = OnePlatList.front();
11439 NPLIt = find(NamePosList.begin(), NamePosList.end(), TempElement.
Conn[0]);
11440 if(NPLIt != NamePosList.end() && ((TempElement.
Link[0] == 2) || (TempElement.
Link[0] == 4) || (TempElement.
Link[0] == 6) || (TempElement.
Link[0] == 8)))
11442 OnePlatList.push_back(TempElement.
Conn[0]);
11443 NamePosList.erase(NPLIt);
11445 NPLIt = find(NamePosList.begin(), NamePosList.end(), TempElement.
Conn[1]);
11446 if(NPLIt != NamePosList.end() && ((TempElement.
Link[1] == 2) || (TempElement.
Link[1] == 4) || (TempElement.
Link[1] == 6) || (TempElement.
Link[1] == 8)))
11448 OnePlatList.push_back(TempElement.
Conn[1]);
11449 NamePosList.erase(NPLIt);
11452 OnePlatList.erase(OnePlatList.begin());
11453 if(OnePlatList.empty())
11456 if(!NamePosList.empty())
11458 OnePlatList.push_back(NamePosList.back());
11459 NamePosList.pop_back();
11475 throw Exception(
"Element at " + AnsiString(FPVIt->TVPos) +
" not signal in RepairFailedSignals");
11479 throw Exception(
"Signals not failed at " + AnsiString(FPVIt->TVPos) +
" in RepairFailedSignals");
11507 throw Exception(
"Element at " + AnsiString(FPVIt->TVPos) +
" not points in RepairFailedPoints");
11511 throw Exception(
"Points not failed at " + AnsiString(FPVIt->TVPos) +
" in RepairFailedPoints");
11537 throw Exception(
"Element at " + AnsiString(FPVIt->TVPos) +
" not simple in RepairFailedPoints");
11541 throw Exception(
"No TSR at " + AnsiString(FPVIt->TVPos) +
" in RepairTSR");
11563 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
11582 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
UserGraphicVector.size()) +
", At: " + AnsiString(At) +
" in UserGraphicVectorAt");
11597 throw Exception(
"Return value negative in call to LastElementNumber");
11609 throw Exception(
"PrefDirVector empty in call to LastElementPtr");
11623 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
PrefDirVector.size()) +
", At: " + AnsiString(At) +
" in GetFixedPrefDirElementAt");
11635 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
PrefDirVector.size()) +
", At: " + AnsiString(At) +
11636 " in GetModifiablePrefDirElementAt");
11646 if((At < 0) || ((
unsigned int)At >=
SearchVector.size()))
11648 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
SearchVector.size()) +
", At: " + AnsiString(At) +
" in GetFixedSearchElementAt");
11658 if((At < 0) || ((
unsigned int)At >=
SearchVector.size()))
11660 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
SearchVector.size()) +
", At: " + AnsiString(At) +
" in GetModifiableSearchElementAt");
11677 int TrackVectorPosition;
11728 FinishElement =
false;
11729 int TrackVectorPosition;
11751 if(TrackElement.
HLoc >= StartPrefDirElement.
HLoc)
11761 if(TrackElement.
VLoc >= StartPrefDirElement.
VLoc)
11784 for(
int x = 0; x < 4; x++)
11807 FinishElement =
true;
11815 for(
int x = 0; x < 4; x++)
11827 FinishElement =
true;
11835 "Unable to find a route to the selected element - may be unreachable, too far ahead, or invalid. Try selecting an end point closer to the start point.");
11842 .ELinkPos] ==
Lead))
11858 FinishElement =
true;
11877 FinishElement =
true;
11896 FinishElement =
true;
11911 FinishElement =
true;
11920 "Unable to find a route to the selected element - may be unreachable, too far ahead, or invalid. Try selecting an end point closer to the start point.");
11936 FinishElement =
true;
11942 "Unable to find a route to the selected element - may be unreachable, too far ahead, or invalid. Try selecting an end point closer to the start point.");
11965 AnsiString(XLinkPos) +
"," + AnsiString(RequiredPosition));
11966 int VectorCount = 0;
11970 if(CurrentTrackElement.
Config[XLinkPos] ==
End)
11972 for(
int x = 0; x < VectorCount; x++)
11979 int NextPosition = CurrentTrackElement.
Conn[XLinkPos];
11983 int NextELinkPos = CurrentTrackElement.
ConnLinkPos[XLinkPos];
11984 SearchElement.
ELinkPos = NextELinkPos;
12005 SearchElement.
XLink = SearchElement.
Link[NextXLinkPos];
12007 SearchElement.
XLinkPos = NextXLinkPos;
12033 for(
int x = 0; x < VectorCount; x++)
12045 for(
int x = 0; x < VectorCount; x++)
12059 for(
int x = 0; x < VectorCount; x++)
12073 for(
int x = 0; x < VectorCount; x++)
12083 for(
int x = 0; x < VectorCount; x++)
12094 SearchElement.
XLink = SearchElement.
Link[1];
12113 SearchElement.
XLink = SearchElement.
Link[3];
12126 for(
int x = 0; x < VectorCount; x++)
12141 XLinkPos = NextXLinkPos;
12142 CurrentTrackElement = SearchElement;
12161 throw Exception(
"Error, SearchVector empty");
12168 for(
int x = 0; x < 4; x++)
12221 throw Exception(
"Error in EntryExitNumber 1");
12240 if(PrefDirElement.
XLink == -1)
12252 if(PrefDirElement.
XLink != -1)
12256 throw Exception(
"Error in EntryExitNumber 2");
12294 LeadingPoints =
false;
12322 LeadingPoints =
true;
12338 AnsiString ErrorString;
12339 bool Error =
false;
12346 ErrorString =
"HLoc";
12352 ErrorString =
"VLoc";
12358 ErrorString =
"ELink";
12364 ErrorString =
"ELinkPos";
12370 ErrorString =
"XLink";
12376 ErrorString =
"XLinkPos";
12382 ErrorString =
"Tag";
12388 ErrorString =
"TrackVectorPosition";
12394 ErrorString =
"EXNumber";
12401 ErrorString =
"CheckCount";
12408 ErrorString =
"EntryGraphicPtr";
12414 ErrorString =
"EntryDirectionGraphicPtr";
12423 ErrorString =
"Last XLink not connected to this element";
12430 throw Exception(
"Error at " + AnsiString(Position) +
" " + ErrorString);
12454 for(
int PrefDirVecPos = (
PrefDirVector.size() - 1); PrefDirVecPos >= (int)x; PrefDirVecPos--)
12511 AnsiString((
short)BuildingPrefDir));
12514 if(PrefDirSize() == 0)
12519 for(
unsigned int x = 0; x < PrefDirSize(); x++)
12531 Disp->PlotOutput(12, (TempPrefDirElement.
HLoc * 16), (TempPrefDirElement.
VLoc * 16), TempPrefDirElement.
EXGraphicPtr);
12543 if(x == (PrefDirSize() - 1))
12552 if((PrefDirRoute ==
PrefDirCall) && BuildingPrefDir)
12554 HPos = GetFixedPrefDirElementAt(4, 0).
HLoc * 16;
12555 VPos = GetFixedPrefDirElementAt(5, 0).VLoc * 16;
12556 Disp->Rectangle(1, HPos, VPos,
clB0G0R5, 2, 2);
12558 if(PrefDirSize() > 1)
12560 unsigned int LatestPos = PrefDirSize() - 1;
12561 HPos = GetFixedPrefDirElementAt(6, LatestPos).HLoc * 16;
12562 VPos = GetFixedPrefDirElementAt(7, LatestPos).VLoc * 16;
12563 Disp->Rectangle(2, HPos, VPos,
clB5G0R0, 4, 2);
12584 int H, V, PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
12587 TPrefDirElement PrefDirElement0, PrefDirElement1, PrefDirElement2, PrefDirElement3;
12591 H = MMIT->first.first;
12592 V = MMIT->first.second;
12595 if(PrefDirPos0 > -1)
12599 if(PrefDirPos1 > -1)
12603 if(PrefDirPos2 > -1)
12607 if(PrefDirPos3 > -1)
12611 if(PrefDirPos3 > -1)
12627 else if(PrefDirPos2 > -1)
12669 else if(PrefDirPos1 > -1)
12692 else if(PrefDirPos0 > -1)
12711 int NumberOfPrefDirElements = 0;
12714 for(
int x = 0; x < NumberOfPrefDirElements; x++)
12716 VecFile >> TempInt;
12719 VecFile >> TempInt;
12720 LoadPrefDirElement.
ELink = TempInt;
12721 VecFile >> TempInt;
12722 LoadPrefDirElement.
ELinkPos = TempInt;
12723 VecFile >> TempInt;
12724 LoadPrefDirElement.
XLink = TempInt;
12725 VecFile >> TempInt;
12726 LoadPrefDirElement.
XLinkPos = TempInt;
12727 VecFile >> TempInt;
12728 LoadPrefDirElement.
EXNumber = TempInt;
12729 VecFile >> TempInt;
12734 if(!(LoadPrefDirElement.
IsARoute))
12760 int NumberOfPrefDirElements = 0;
12763 for(
int x = 0; x < NumberOfPrefDirElements; x++)
12765 VecFile >> TempInt;
12766 VecFile >> TempInt;
12769 VecFile >> TempInt;
12770 LoadPrefDirElement.
ELink = TempInt;
12771 VecFile >> TempInt;
12772 LoadPrefDirElement.
ELinkPos = TempInt;
12773 VecFile >> TempInt;
12774 LoadPrefDirElement.
XLink = TempInt;
12775 VecFile >> TempInt;
12776 LoadPrefDirElement.
XLinkPos = TempInt;
12777 VecFile >> TempInt;
12778 LoadPrefDirElement.
EXNumber = TempInt;
12779 VecFile >> TempInt;
12784 if(!(LoadPrefDirElement.
IsARoute))
12812 int NumberOfPrefDirElements = 0;
12815 if((NumberOfPrefDirElements < 0) || (NumberOfPrefDirElements > 1000000))
12820 for(
int x = 0; x < NumberOfPrefDirElements; x++)
12827 VecFile >> TempInt;
12828 if((TempInt < 0) || (TempInt >= NumberOfActiveElements))
12833 VecFile >> TempInt;
12834 if((TempInt < -1) || (TempInt > 9))
12839 VecFile >> TempInt;
12840 if((TempInt < -1) || (TempInt > 3))
12845 VecFile >> TempInt;
12846 if((TempInt < -1) || (TempInt > 9))
12851 VecFile >> TempInt;
12852 if((TempInt < -1) || (TempInt > 3))
12857 VecFile >> TempInt;
12858 if((TempInt < -1) || (TempInt > 27))
12863 VecFile >> TempInt;
12871 VecFile >> TempInt;
12872 if((TempInt != 0) && (TempInt != 1))
12877 VecFile >> TempInt;
12878 if((TempInt != 0) && (TempInt != 1))
12883 VecFile >> TempInt;
12884 if((TempInt != 0) && (TempInt != 1))
12907 for(
int y = 0; y < NumberOfPrefDirElements; y++)
12909 VecFile << y <<
'\n';
12910 VecFile <<
PrefDirVector.at(y).TrackVectorPosition <<
'\n';
12920 if(y == (NumberOfPrefDirElements - 1))
12922 VecFile <<
"************" <<
'\0' <<
'\n';
12926 VecFile <<
"******" <<
'\0' <<
'\n';
12940 for(
int y = 0; y < NumberOfSearchElements; y++)
12942 VecFile << y <<
'\n';
12943 VecFile <<
SearchVector.at(y).TrackVectorPosition <<
'\n';
12953 if(y == (NumberOfSearchElements - 1))
12955 VecFile <<
"************" <<
'\0' <<
'\n';
12959 VecFile <<
"******" <<
'\0' <<
'\n';
13072 bool AlreadyPresent, FoundFlag;
13073 int PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
13075 for(
unsigned int x = 0; x < InputPrefDir->
PrefDirSize(); x++)
13079 AlreadyPresent =
false;
13084 AlreadyPresent =
true;
13088 AlreadyPresent =
true;
13092 AlreadyPresent =
true;
13096 AlreadyPresent =
true;
13099 if(!AlreadyPresent)
13146 for(
unsigned int z = 0; z < 4; z++)
13154 throw Exception(
"Error in RebuildPrefDirVector - PrefDirVector is unsafe");
13168 bool DiscrepancyFound =
false;
13179 DiscrepancyFound =
true;
13184 DiscrepancyFound =
true;
13189 DiscrepancyFound =
true;
13194 DiscrepancyFound =
true;
13199 DiscrepancyFound =
true;
13205 DiscrepancyFound =
true;
13208 if(DiscrepancyFound)
13210 ShowMessage(
"Discrepancies found in the preferred direction file, preferred directions will be cleared");
13225 bool DiscrepancyFound =
false;
13236 DiscrepancyFound =
true;
13240 DiscrepancyFound =
true;
13245 DiscrepancyFound =
true;
13250 DiscrepancyFound =
true;
13255 DiscrepancyFound =
true;
13261 DiscrepancyFound =
true;
13265 return(!DiscrepancyFound);
13277 bool FoundFlag =
false;
13278 int PrefDir0, PrefDir1, PrefDir2, PrefDir3;
13286 throw Exception(
"CheckPrefDir4MultiMap Error - failed to find HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" + (AnsiString)CheckElement.
VLoc +
13287 " in PrefDir4MultiMap, Caller=" + (AnsiString)Caller);
13289 if((PrefDir0 != (
int)a) && (PrefDir1 != (
int)a) && (PrefDir2 != (
int)a) && (PrefDir3 != (
int)a))
13291 throw Exception(
"CheckPrefDir4MultiMap Error - MapVectorPosition failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
13292 (AnsiString)CheckElement.
VLoc +
" Map values=" + (AnsiString)PrefDir0 +
", " + (AnsiString)PrefDir1 +
", " + (AnsiString)PrefDir2 +
", " +
13293 (AnsiString)PrefDir3 +
" PrefDirVectorPos value=" + (AnsiString)a +
" Caller=" + (AnsiString)Caller);
13298 throw Exception(
"CheckPrefDir4MultiMap Error - Map Size=" + (AnsiString)
PrefDirVector.size() +
" PrefDirVectorSize=" + (AnsiString)
PrefDirVector.size()
13299 +
" Caller=" + (AnsiString)Caller);
13325 PrefDirMapKeyPair.first = HLoc;
13326 PrefDirMapKeyPair.second = VLoc;
13327 std::pair<TPrefDir4MultiMapIterator, TPrefDir4MultiMapIterator>ItPair;
13330 if(ItPair.first == ItPair.second)
13338 PrefDirPos0 = ItPair.first->second;
13340 if(ItPair.first == ItPair.second)
13345 if(((ItPair.first->first).first == HLoc) && ((ItPair.first->first).second == VLoc))
13347 PrefDirPos1 = ItPair.first->second;
13350 if(ItPair.first == ItPair.second)
13355 if(((ItPair.first->first).first == HLoc) && ((ItPair.first->first).second == VLoc))
13357 PrefDirPos2 = ItPair.first->second;
13360 if(ItPair.first == ItPair.second)
13365 if(((ItPair.first->first).first == HLoc) && ((ItPair.first->first).second == VLoc))
13367 PrefDirPos3 = ItPair.first->second;
13382 +
"," + AnsiString(LinkNumberPos));
13384 int PD0, PD1, PD2, PD3;
13385 if(
PrefDirVector.at(PrefDirVectorNumber).Conn[LinkNumberPos] > -1)
13389 PD0, PD1, PD2, PD3);
13401 LinkedPrefDirVectorNumber = PD0;
13410 LinkedPrefDirVectorNumber = PD1;
13420 LinkedPrefDirVectorNumber = PD0;
13429 LinkedPrefDirVectorNumber = PD1;
13438 LinkedPrefDirVectorNumber = PD2;
13447 LinkedPrefDirVectorNumber = PD3;
13452 LinkedPrefDirVectorNumber = -1;
13458 LinkedPrefDirVectorNumber = -1;
13463 catch(
const Exception &e)
13465 LinkedPrefDirVectorNumber = -1;
13480 +
"," + AnsiString(LinkNumberPos));
13482 int PD0, PD1, PD2, PD3;
13483 if(
PrefDirVector.at(PrefDirVectorNumber).Conn[LinkNumberPos] > -1)
13487 PD0, PD1, PD2, PD3);
13500 LinkedPrefDirVectorNumber = PD0;
13510 LinkedPrefDirVectorNumber = PD1;
13515 LinkedPrefDirVectorNumber = -1;
13523 LinkedPrefDirVectorNumber = PD0;
13532 LinkedPrefDirVectorNumber = PD1;
13541 LinkedPrefDirVectorNumber = PD2;
13550 LinkedPrefDirVectorNumber = PD3;
13555 LinkedPrefDirVectorNumber = -1;
13561 LinkedPrefDirVectorNumber = -1;
13566 catch(
const Exception &e)
13568 LinkedPrefDirVectorNumber = -1;
13580 int PD0, PD1, PD2, PD3;
13632 THVPair PrefDir4MultiMapKeyPair;
13635 PrefDir4MultiMapKeyPair.first = LoadPrefDirElement.
HLoc;
13636 PrefDir4MultiMapKeyPair.second = LoadPrefDirElement.
VLoc;
13637 PrefDir4MultiMapEntry.first = PrefDir4MultiMapKeyPair;
13660 throw Exception(
"Failed to find PrefDir4MultiMap erase element");
13679 AnsiString(ErasedElementNumber));
13684 if(MapPtr->second > ErasedElementNumber)
13706 throw Exception(
"PrefDirVectorPosition out of range");
13709 THVPair PrefDir4MultiMapKeyPair;
13711 PrefDir4MultiMapKeyPair.first = PrefDirElement.
HLoc;
13712 PrefDir4MultiMapKeyPair.second = PrefDirElement.
VLoc;
13713 std::pair<TPrefDir4MultiMapIterator, TPrefDir4MultiMapIterator>ItPair;
13716 if(ItPair.first == ItPair.second)
13719 return(ItPair.first);
13723 if(ItPair.first->second == PrefDirVectorPosition)
13727 return(ItPair.first);
13730 if(ItPair.first == ItPair.second)
13733 return(ItPair.first);
13735 if(ItPair.first->second == PrefDirVectorPosition)
13739 return(ItPair.first);
13742 if(ItPair.first == ItPair.second)
13745 return(ItPair.first);
13747 if(ItPair.first->second == PrefDirVectorPosition)
13751 return(ItPair.first);
13754 if(ItPair.first == ItPair.second)
13757 return(ItPair.first);
13759 if(ItPair.first->second == PrefDirVectorPosition)
13763 return(ItPair.first);
13767 return(ItPair.first);
13780 THVPair PrefDir4MultiMapKeyPair;
13782 PrefDir4MultiMapKeyPair.first = HLoc;
13783 PrefDir4MultiMapKeyPair.second = VLoc;
13784 std::pair<TPrefDir4MultiMapIterator, TPrefDir4MultiMapIterator>ItPair;
13787 if(ItPair.first == ItPair.second)
13795 return(ItPair.first->second);
13804 bool ErasedFlag =
false;
13806 if(ErasedTrackVectorPosition > -1)
13815 ErasedFlag =
false;
13817 if(
PrefDirVector.at(x).TrackVectorPosition == ErasedTrackVectorPosition)
13822 else if(
PrefDirVector.at(x).Conn[0] == ErasedTrackVectorPosition)
13827 else if(
PrefDirVector.at(x).Conn[1] == ErasedTrackVectorPosition)
13832 else if(
PrefDirVector.at(x).Conn[2] == ErasedTrackVectorPosition)
13837 else if(
PrefDirVector.at(x).Conn[3] == ErasedTrackVectorPosition)
13845 if(
PrefDirVector.at(x).TrackVectorPosition > ErasedTrackVectorPosition)
13849 if(
PrefDirVector.at(x).Conn[0] > ErasedTrackVectorPosition)
13853 if(
PrefDirVector.at(x).Conn[1] > ErasedTrackVectorPosition)
13857 if(
PrefDirVector.at(x).Conn[2] > ErasedTrackVectorPosition)
13861 if(
PrefDirVector.at(x).Conn[3] > ErasedTrackVectorPosition)
13876 OverallDistance = 0;
13877 OverallSpeedLimit = 0;
13878 LeadingPointsAtLastElement =
false;
13886 LeadingPointsAtLastElement =
true;
13895 OverallDistance += PrefDirElement.
Length23;
13896 if(OverallSpeedLimit != -1)
13906 OverallSpeedLimit = -1;
13913 OverallDistance += PrefDirElement.
Length01;
13914 if(OverallSpeedLimit != -1)
13924 OverallSpeedLimit = -1;
13943 int H, V, HLoc, VLoc, PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
13946 TPrefDirElement PrefDirElement0, PrefDirElement1, PrefDirElement2, PrefDirElement3;
13950 HLoc = MMIT->first.first;
13951 VLoc = MMIT->first.second;
13956 if(PrefDirPos0 > -1)
13960 if(PrefDirPos1 > -1)
13964 if(PrefDirPos2 > -1)
13968 if(PrefDirPos3 > -1)
13972 if(PrefDirPos3 > -1)
13975 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
true));
13977 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
true));
13979 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement2.
GetRouteGraphicPtr(
false,
true));
13981 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement3.
GetRouteGraphicPtr(
false,
true));
13988 else if(PrefDirPos2 > -1)
13993 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
true));
13995 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
true));
13997 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement2.
GetRouteGraphicPtr(
false,
false));
14006 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
true));
14008 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement2.
GetRouteGraphicPtr(
false,
true));
14010 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
false));
14019 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
true));
14021 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement2.
GetRouteGraphicPtr(
false,
true));
14023 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
false));
14030 else if(PrefDirPos1 > -1)
14035 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
true));
14037 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
true));
14045 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
false));
14047 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
false));
14053 else if(PrefDirPos0 > -1)
14055 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
false));
14072 int PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
14075 TPrefDirElement PrefDirElement0, PrefDirElement1, PrefDirElement2, PrefDirElement3;
14096 if(PrefDirPos0 > -1)
14100 if(PrefDirPos1 > -1)
14104 if(PrefDirPos2 > -1)
14108 if(PrefDirPos3 > -1)
14112 if(PrefDirPos3 > -1)
14117 else if(PrefDirPos2 > -1)
14119 if((PrefDirElement0.
XLinkPos == EntryPos) || (PrefDirElement1.
XLinkPos == EntryPos) || (PrefDirElement2.
XLinkPos == EntryPos))
14130 else if(PrefDirPos1 > -1)
14132 if((PrefDirElement0.
XLinkPos == EntryPos) || (PrefDirElement1.
XLinkPos == EntryPos))
14143 else if(PrefDirPos0 > -1)
14145 if(PrefDirElement0.
XLinkPos == EntryPos)
14182 ElementIn.
VLoc +
"," + XLink);
14184 bool TrackFoundFlag;
14187 if((XLink == 2) || (XLink == 4) || (XLink == 6) || (XLink == 8))
14199 if((TempTrackElement.
Link[0] == 3) || (TempTrackElement.
Link[1] == 3) || (TempTrackElement.
Link[2] == 3) || (TempTrackElement.
Link[3] == 3))
14209 if((TempTrackElement.
Link[0] == 7) || (TempTrackElement.
Link[1] == 7) || (TempTrackElement.
Link[2] == 7) || (TempTrackElement.
Link[3] == 7))
14223 if((TempTrackElement.
Link[0] == 1) || (TempTrackElement.
Link[1] == 1) || (TempTrackElement.
Link[2] == 1) || (TempTrackElement.
Link[3] == 1))
14233 if((TempTrackElement.
Link[0] == 9) || (TempTrackElement.
Link[1] == 9) || (TempTrackElement.
Link[2] == 9) || (TempTrackElement.
Link[3] == 9))
14247 if((TempTrackElement.
Link[0] == 9) || (TempTrackElement.
Link[1] == 9) || (TempTrackElement.
Link[2] == 9) || (TempTrackElement.
Link[3] == 9))
14257 if((TempTrackElement.
Link[0] == 1) || (TempTrackElement.
Link[1] == 1) || (TempTrackElement.
Link[2] == 1) || (TempTrackElement.
Link[3] == 1))
14271 if((TempTrackElement.
Link[0] == 7) || (TempTrackElement.
Link[1] == 7) || (TempTrackElement.
Link[2] == 7) || (TempTrackElement.
Link[3] == 7))
14281 if((TempTrackElement.
Link[0] == 3) || (TempTrackElement.
Link[1] == 3) || (TempTrackElement.
Link[2] == 3) || (TempTrackElement.
Link[3] == 3))
14304 bool FoundFlag, ContFlag, FoundElements =
false;
14305 int PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
14310 LastIteratorValue++;
14335 if(PDVIt->XLinkPos == 0)
14340 StartElement = *PDVIt;
14349 int NextTrackVectorPosition = PDVIt->
Conn[PDVIt->GetXLinkPos()];
14351 Track->
TrackElementAt(879, NextTrackVectorPosition).
VLoc, FoundFlag, PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3);
14352 if(PrefDirPos0 == -1)
14356 bool NextElementFoundFlag =
false;
14360 NextElementFoundFlag =
true;
14362 if(PrefDirPos1 > -1)
14367 NextElementFoundFlag =
true;
14370 if(PrefDirPos2 > -1)
14375 NextElementFoundFlag =
true;
14378 if(PrefDirPos3 > -1)
14383 NextElementFoundFlag =
true;
14386 if(!NextElementFoundFlag)
14416 EndElement = NextElement;
14420 NextTrackVectorPosition = NextElement.
Conn[NextElement.
GetXLinkPos()];
14422 Track->
TrackElementAt(881, NextTrackVectorPosition).
VLoc, FoundFlag, PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3);
14423 if(PrefDirPos0 == -1)
14433 if(PrefDirPos1 > -1)
14441 if(PrefDirPos2 > -1)
14449 if(PrefDirPos3 > -1)
14480 FoundElements =
true;
14514 AnsiString(VLoc) +
"," + AnsiString((
short)AutoSigsFlag));
14516 int TrackVectorPosition;
14552 int LockedVectorNumber;
14575 bool InPrefDirFlag =
false;
14578 int PrefDirPos0 = -1;
14579 int PrefDirPos1 = -1;
14580 int PrefDirPos2 = -1;
14581 int PrefDirPos3 = -1;
14585 int PrefDirVecPos[4] =
14587 PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3
14590 for(
int x = 0; x < 4; x++)
14592 int b = PrefDirVecPos[x];
14602 InPrefDirFlag =
true;
14615 TrainController->
StopTTClockMessage(12,
"Route and preferred direction mismatch. If no preferred direction then only red routes can be used. Green and blue route directions must correspond to the preferred direction.");
14623 if(DummyPair.first > -1)
14625 throw Exception(
"Selection in two routes - should never happen!");
14627 if(RoutePair.first > -1)
14703 IDInt &ReqPosRouteID,
bool &PointsChanged)
14737 AnsiString(VLoc) +
"," + AnsiString((
short)ConsecSignals) +
"," + AnsiString((
short)AutoSigsFlag));
14739 int NewFailedPointsTVPos = -1;
14788 bool InPrefDirFlag =
false;
14791 int PrefDirPos0 = -1;
14792 int PrefDirPos1 = -1;
14793 int PrefDirPos2 = -1;
14794 int PrefDirPos3 = -1;
14797 PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3);
14798 int PrefDirVecPos[4] =
14800 PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3
14803 for(
int x = 0; x < 4; x++)
14805 int b = PrefDirVecPos[x];
14808 InPrefDirFlag =
true;
14821 TrainController->
StopTTClockMessage(23,
"Route and preferred direction mismatch. If no preferred direction then only red routes can be used. Green and blue route directions must correspond to the preferred direction.");
14830 if(RoutePair.first > -1)
14832 if(RoutePair.second != 0)
14849 EndElement1 = RouteElement;
14850 EndElement2 = BlankElement;
14945 AutoSigsFlag,
false))
14950 if(NewFailedPointsTVPos > -1)
14954 " failed during route setting.\nTry to find a different route.");
14958 PointsChanged =
true;
14981 AutoSigsFlag,
false))
14986 if(NewFailedPointsTVPos > -1)
14990 " failed during route setting.\nTry to find a different route.");
14994 PointsChanged =
true;
15012 AutoSigsFlag,
false))
15017 if(NewFailedPointsTVPos > -1)
15021 " failed during route setting.\nTry to find a different route.");
15025 PointsChanged =
true;
15049 AutoSigsFlag,
false))
15054 if(NewFailedPointsTVPos > -1)
15058 " failed during route setting.\nTry to find a different route.");
15062 PointsChanged =
true;
15071 AutoSigsFlag,
false))
15076 if(NewFailedPointsTVPos > -1)
15080 " failed during route setting.\nTry to find a different route.");
15084 PointsChanged =
true;
15095 AutoSigsFlag,
false))
15100 if(NewFailedPointsTVPos > -1)
15104 " failed during route setting.\nTry to find a different route.");
15108 PointsChanged =
true;
15114 AutoSigsFlag,
false))
15119 if(NewFailedPointsTVPos > -1)
15123 " failed during route setting.\nTry to find a different route.");
15127 PointsChanged =
true;
15138 AutoSigsFlag,
false))
15143 if(NewFailedPointsTVPos > -1)
15147 " failed during route setting.\nTry to find a different route.");
15151 PointsChanged =
true;
15205 TOnePrefDir *EveryPrefDir,
bool ConsecSignals,
int EndPosition,
bool AutoSigsFlag,
bool RecursiveCall)
15257 AnsiString(XLinkPos) +
"," + AnsiString(RequiredPosition) +
"," + AnsiString(
ReqPosRouteID.
GetInt()) +
"," + AnsiString(EndPosition) +
"," +
15258 AnsiString((
short)AutoSigsFlag));
15259 int VectorCount = 0;
15263 if((PrefDirElement.
XLink == 1) || (PrefDirElement.
XLink == 3) || (PrefDirElement.
XLink == 7) || (PrefDirElement.
XLink == 9))
15267 for(
int x = 0; x < VectorCount; x++)
15275 bool FirstPass =
true;
15285 for(
int x = 0; x < VectorCount; x++)
15294 for(
int x = 0; x < VectorCount; x++)
15306 for(
int x = 0; x < VectorCount; x++)
15314 int NextPosition = PrefDirElement.
Conn[XLinkPos];
15318 int NextELinkPos = PrefDirElement.
ConnLinkPos[XLinkPos];
15319 SearchElement.
ELinkPos = NextELinkPos;
15320 SearchElement.
ELink = SearchElement.
Link[NextELinkPos];
15341 SearchElement.
XLink = SearchElement.
Link[NextXLinkPos];
15343 SearchElement.
XLinkPos = NextXLinkPos;
15356 for(
int x = 0; x < VectorCount; x++)
15370 if(RoutePair.first > -1)
15379 for(
int x = 0; x < VectorCount; x++)
15388 if(SecondPair.first > -1)
15397 for(
int x = 0; x < VectorCount; x++)
15411 for(
int x = 0; x < VectorCount; x++)
15422 for(
int x = 0; x < VectorCount; x++)
15431 for(
int x = 0; x < VectorCount; x++)
15440 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
15444 for(
int x = 0; x < VectorCount; x++)
15454 bool InPrefDirFlag =
false;
15455 PrefDirElement1 = BlankElement;
15456 PrefDirElement2 = BlankElement;
15459 int PrefDirPos0 = -1;
15460 int PrefDirPos1 = -1;
15461 int PrefDirPos2 = -1;
15462 int PrefDirPos3 = -1;
15465 int PrefDirVecPos[4] =
15467 PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3
15469 for(
int x = 0; x < 4; x++)
15471 int b = PrefDirVecPos[x];
15474 InPrefDirFlag =
true;
15487 for(
int x = 0; x < VectorCount; x++)
15499 for(
int x = 0; x < VectorCount; x++)
15515 for(
int x = 0; x < VectorCount; x++)
15535 for(
int x = 0; x < VectorCount; x++)
15547 for(
int x = 0; x < VectorCount; x++)
15561 for(
int x = 0; x < VectorCount; x++)
15571 for(
int x = 0; x < VectorCount; x++)
15602 for(
int x = 0; x < VectorCount; x++)
15611 for(
int x = 0; x < VectorCount; x++)
15623 int SearchPos1 = SearchElement.
Attribute + 1;
15625 if(SearchPos1 == 2)
15629 if(SearchPos1 == 1)
15637 SearchElement.
XLink = SearchElement.
Link[SearchPos1];
15638 SearchElement.
XLinkPos = SearchPos1;
15639 InPrefDirFlag =
false;
15640 if(SearchElement.
XLink == PrefDirElement1.
XLink)
15642 SearchElement = PrefDirElement1;
15643 InPrefDirFlag =
true;
15645 else if(SearchElement.
XLink == PrefDirElement2.
XLink)
15647 SearchElement = PrefDirElement2;
15648 InPrefDirFlag =
true;
15654 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
15658 for(
int x = 0; x < VectorCount; x++)
15676 AutoSigsFlag,
true))
15685 for(
int x = 0; x < VectorCount; x++)
15694 for(
int x = 0; x < VectorCount; x++)
15712 SearchElement.
XLink = SearchElement.
Link[SearchPos2];
15713 SearchElement.
XLinkPos = SearchPos2;
15714 if(SearchElement.
XLink == PrefDirElement1.
XLink)
15716 SearchElement = PrefDirElement1;
15718 else if(SearchElement.
XLink == PrefDirElement2.
XLink)
15720 SearchElement = PrefDirElement2;
15724 for(
int x = 0; x < VectorCount; x++)
15732 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
15736 for(
int x = 0; x < VectorCount; x++)
15755 AutoSigsFlag,
true))
15764 for(
int x = 0; x < VectorCount; x++)
15773 for(
int x = 0; x < VectorCount; x++)
15785 for(
int x = 0; x < VectorCount; x++)
15795 SearchElement = PrefDirElement1;
15804 XLinkPos = SearchElement.
XLinkPos;
15805 PrefDirElement = SearchElement;
15862 unsigned int TruncatePrefDirPosition = 0;
15935 throw Exception(
"Error - failed to validate extended route for preferred route");
15990 throw Exception(
"Error - failed to validate single route for preferred route");
16035 AnsiString(VLoc) +
"," + AnsiString((
short)Callon));
16037 int TrackVectorPosition;
16074 int LockedVectorNumber;
16108 PrefDirElement1.
ELink = PrefDirElement1.
Link[0];
16109 PrefDirElement1.
XLink = PrefDirElement1.
Link[1];
16112 throw Exception(
"Error, No EXNumber for PrefDirElement1 in GetNonPreferredRouteStartElement");
16118 PrefDirElement2.
ELink = PrefDirElement2.
Link[1];
16119 PrefDirElement2.
XLink = PrefDirElement2.
Link[0];
16122 throw Exception(
"Error, No EXNumber for PrefDirElement2 in GetNonPreferredRouteStartElement");
16136 if(RoutePair.first > -1)
16271 int NewFailedPointsTVPos = -1;
16336 EndElement1.
ELink = EndElement1.
Link[0];
16337 EndElement1.
XLink = EndElement1.
Link[1];
16340 throw Exception(
"Error, No EXNumber for EndElement1 in GetNonPreferredRouteStartElement");
16345 EndElement2.
ELink = EndElement2.
Link[1];
16346 EndElement2.
XLink = EndElement2.
Link[0];
16349 throw Exception(
"Error, No EXNumber for EndElement2 in GetNonPreferredRouteStartElement");
16393 if(RoutePair.first > -1)
16395 if(RoutePair.second != 0)
16418 EndElement2 = BlankElement;
16503 if(NewFailedPointsTVPos > -1)
16507 " failed during route setting.\nTry to find a different route.");
16511 PointsChanged =
true;
16537 if(NewFailedPointsTVPos > -1)
16541 " failed during route setting.\nTry to find a different route.");
16545 PointsChanged =
true;
16567 if(NewFailedPointsTVPos > -1)
16571 " failed during route setting.\nTry to find a different route.");
16575 PointsChanged =
true;
16601 if(NewFailedPointsTVPos > -1)
16605 " failed during route setting.\nTry to find a different route.");
16609 PointsChanged =
true;
16623 if(NewFailedPointsTVPos > -1)
16627 " failed during route setting.\nTry to find a different route.");
16631 PointsChanged =
true;
16671 AnsiString(XLinkPos) +
"," + AnsiString(RequiredPosition) +
"," + AnsiString() +
"," + AnsiString(
ReqPosRouteID.
GetInt()));
16672 int VectorCount = 0;
16675 if((CurrentTrackElement.
Link[XLinkPos] == 1) || (CurrentTrackElement.
Link[XLinkPos] == 3) || (CurrentTrackElement.
Link[XLinkPos] == 7) ||
16676 (CurrentTrackElement.
Link[XLinkPos] == 9))
16680 for(
int x = 0; x < VectorCount; x++)
16692 for(
int x = 0; x < VectorCount; x++)
16699 if(CurrentTrackElement.
Config[XLinkPos] ==
End)
16701 for(
int x = 0; x < VectorCount; x++)
16708 int NextPosition = CurrentTrackElement.
Conn[XLinkPos];
16712 int NextELinkPos = CurrentTrackElement.
ConnLinkPos[XLinkPos];
16713 SearchElement.
ELinkPos = NextELinkPos;
16734 SearchElement.
XLink = SearchElement.
Link[NextXLinkPos];
16736 SearchElement.
XLinkPos = NextXLinkPos;
16749 for(
int x = 0; x < VectorCount; x++)
16763 if(RoutePair.first > -1)
16772 for(
int x = 0; x < VectorCount; x++)
16781 if(SecondPair.first > -1)
16790 for(
int x = 0; x < VectorCount; x++)
16804 for(
int x = 0; x < VectorCount; x++)
16815 for(
int x = 0; x < VectorCount; x++)
16824 for(
int x = 0; x < VectorCount; x++)
16833 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
16837 for(
int x = 0; x < VectorCount; x++)
16850 for(
int x = 0; x < VectorCount; x++)
16878 for(
int x = 0; x < VectorCount; x++)
16891 for(
int x = 0; x < VectorCount; x++)
16901 for(
int x = 0; x < VectorCount; x++)
16926 for(
int x = 0; x < VectorCount; x++)
16935 for(
int x = 0; x < VectorCount; x++)
16948 int SearchPos1 = SearchElement.
Attribute + 1;
16950 if(SearchPos1 == 2)
16954 if(SearchPos1 == 1)
16963 SearchElement.
XLink = SearchElement.
Link[SearchPos1];
16964 SearchElement.
XLinkPos = SearchPos1;
16966 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
16970 for(
int x = 0; x < VectorCount; x++)
16988 for(
int x = 0; x < VectorCount; x++)
17004 SearchElement.
XLink = SearchElement.
Link[SearchPos2];
17005 SearchElement.
XLinkPos = SearchPos2;
17007 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
17011 for(
int x = 0; x < VectorCount; x++)
17027 for(
int x = 0; x < VectorCount; x++)
17039 for(
int x = 0; x < VectorCount; x++)
17054 CurrentTrackElement = SearchElement;
17055 XLinkPos = SearchElement.
XLinkPos;
17077 throw Exception(
"Error, SearchVector empty");
17089 for(
int x = 0; x < 4; x++)
17131 throw Exception(
"Error in EntryExitNumber 3");
17186 unsigned int TruncatePrefDirPosition = 0;
17246 throw Exception(
"Failed to validate extended route for nonpreferred route");
17291 throw Exception(
"Failed to validate single route for nonpreferred route");
17311 if(!PrefDirVector.empty())
17315 if((PrefDirPtr->TrackType ==
Points) && ((PrefDirPtr->ELinkPos == 1) || (PrefDirPtr->XLinkPos == 1)))
17320 if((PrefDirPtr->TrackType ==
Points) && ((PrefDirPtr->ELinkPos == 3) || (PrefDirPtr->XLinkPos == 3)))
17355 if(!PrefDirVector.empty())
17358 TPrefDirElement LastElement = GetFixedPrefDirElementAt(185, PrefDirSize() - 1);
17360 int ForwardLinkedRouteNumber, Attribute = 0;
17367 if(ForwardLinkedRouteNumber > -1)
17369 int NextForwardLinkedRouteNumber = -1;
17373 ForwardLinkedRouteNumber = NextForwardLinkedRouteNumber;
17383 GetFixedPrefDirElementAt(193, 0).XLinkPos, RouteNumber);
17400 NewFailedPointsTVPos = -1;
17401 bool PointsChanged =
false;
17409 if((SearchPtr->TrackType ==
Points) && ((SearchPtr->ELinkPos == 1) || (SearchPtr->XLinkPos == 1)))
17419 NewFailedPointsTVPos = SearchPtr->TrackVectorPosition;
17420 IFE.
TVPos = NewFailedPointsTVPos;
17439 PointsChanged =
true;
17442 if((SearchPtr->TrackType ==
Points) && ((SearchPtr->ELinkPos == 3) || (SearchPtr->XLinkPos == 3)))
17452 NewFailedPointsTVPos = SearchPtr->TrackVectorPosition;
17453 IFE.
TVPos = NewFailedPointsTVPos;
17472 PointsChanged =
true;
17478 return(PointsChanged);
17498 NextForwardLinkedRouteNumber = -1;
17499 for(
unsigned int x = 0; x < PrefDirSize(); x++)
17501 int TrainID =
Track->
TrackElementAt(100, PrefDirVector.at(x).TrackVectorPosition).TrainIDOnElement;
17502 if(PrefDirVector.at(x).TrackType ==
Bridge)
17504 if(PrefDirVector.at(x).XLinkPos < 2)
17506 TrainID =
Track->
TrackElementAt(101, PrefDirVector.at(x).TrackVectorPosition).TrainIDOnBridgeOrFailedPointOrigSpeedLimit01;
17510 TrainID =
Track->
TrackElementAt(102, PrefDirVector.at(x).TrackVectorPosition).TrainIDOnBridgeOrFailedPointOrigSpeedLimit23;
17518 if(PrefDirVector.at(x).TrackType ==
Buffers)
17530 if(
Track->
IsLCAtHV(42, PrefDirVector.at(x).HLoc, PrefDirVector.at(x).VLoc))
17539 if(PrefDirVector.at(x).Config[PrefDirVector.at(x).XLinkPos] ==
Signal)
17541 Attribute =
Track->
TrackElementAt(103, PrefDirVector.at(x).TrackVectorPosition).Attribute + 1;
17549 if(x == PrefDirSize() - 1)
17593 AnsiString(PrefDirVectorStartPosition));
17598 bool SkipContinuationAndBufferAttributeChange =
false;
17600 if(!PrefDirVector.empty())
17602 for(
TPrefDirVectorConstIterator PrefDirPtr = (PrefDirVector.begin() + PrefDirVectorStartPosition); PrefDirPtr < PrefDirVector.end(); PrefDirPtr++)
17605 if(PrefDirPtr->TrackType ==
Bridge)
17607 if(PrefDirPtr->XLinkPos < 2)
17618 SkipContinuationAndBufferAttributeChange =
true;
17633 SkipContinuationAndBufferAttributeChange =
true;
17641 SkipContinuationAndBufferAttributeChange =
true;
17643 if(!SkipContinuationAndBufferAttributeChange)
17645 if(PrefDirVector.back().TrackType ==
Buffers)
17654 for(
TPrefDirVectorConstIterator PrefDirPtr = (PrefDirVector.begin() + PrefDirVectorStartPosition); PrefDirPtr >= PrefDirVector.begin(); PrefDirPtr--)
17657 if(PrefDirPtr->TrackType ==
Bridge)
17659 if(PrefDirPtr->XLinkPos < 2)
17675 if(
Track->
IsLCAtHV(20, PrefDirPtr->HLoc, PrefDirPtr->VLoc))
17684 if(PrefDirPtr->Config[PrefDirPtr->XLinkPos] ==
Signal)
17686 if((!
AllRoutes->
RouteTruncateFlag) || (PrefDirPtr != (PrefDirVector.begin() + PrefDirVectorStartPosition)) || PrefDirPtr->AutoSignals ||
17687 PrefDirPtr->PrefDirRoute)
17691 int LockedVecNum = 0;
17693 bool KeepAttributeAt0ForLockedRoute =
false;
17698 KeepAttributeAt0ForLockedRoute =
true;
17724 if((Attribute < 3) && !KeepAttributeAt0ForLockedRoute)
17752 "," + AnsiString((
short)PrefDirRoute));
17753 bool ElementInRoute =
false;
17754 bool TrainOccupyingRoute =
false;
17760 ElementInRoute =
true;
17764 if(!ElementInRoute)
17792 TrainOccupyingRoute =
true;
17859 if(LRVIT->RouteNumber == RouteNumber)
17873 int button = Application->MessageBox(L
"Train approaching or occupying route, YES to lock route (2 minutes to release), NO to cancel",
17874 L
"Warning!", MB_YESNO | MB_ICONWARNING);
17886 bool ExistingLockedRouteModified =
false;
17899 if(LRVIT->RouteNumber == RouteNumber)
17903 ExistingLockedRouteModified =
true;
17907 if(!ExistingLockedRouteModified)
17997 AnsiString((
short)PrefDirRoute));
18022 AnsiString((
short)PrefDirRoute));
18032 RouteFlashElement.
HLoc = H;
18033 RouteFlashElement.
VLoc = V;
18049 int H = PrefDirPtr->HLoc;
18050 int V = PrefDirPtr->VLoc;
18117 for(
unsigned int x = 0; x < RouteFlashVector.size(); x++)
18123 Display->
PlotOutput(21, RouteFlashVector.at(x).HLoc * 16, RouteFlashVector.at(x).VLoc * 16, RouteFlashVector.at(x).OriginalGraphic);
18126 OverlayPlotted =
false;
18147 bool FirstSignalFound =
false;
18154 if(PDVIt->TrackType ==
Points)
18156 if((PDVIt->ELinkPos == 1) || (PDVIt->XLinkPos == 1))
18167 else if((PDVIt->ELinkPos == 3) || (PDVIt->XLinkPos == 3))
18183 if(!FirstSignalFound && (PDVIt->Config[PDVIt->XLinkPos] ==
Signal))
18185 FirstSignalFound =
true;
18188 else if(FirstSignalFound && (PDVIt->Config[PDVIt->XLinkPos] ==
Signal))
18193 IFE.
TVPos = PDVIt->TrackVectorPosition;
18199 " failed when changing aspect.\nTrains can only pass under signaller control.");
18228 if((At < 0) || ((
unsigned int)At >= AllRoutesVector.size()))
18230 throw Exception(
"Out of Range Error, vector size: " + AnsiString(AllRoutesVector.size()) +
", At: " + AnsiString(At) +
" in GetFixedRouteAt");
18233 return(AllRoutesVector.at(At));
18241 if((At < 0) || ((
unsigned int)At >= AllRoutesVector.size()))
18243 throw Exception(
"Out of Range Error, vector size: " + AnsiString(AllRoutesVector.size()) +
", At: " + AnsiString(At) +
" in GetModifiableRouteAt");
18246 return(AllRoutesVector.at(At));
18257 for(
unsigned int a = 0; a < AllRoutesSize(); a++)
18259 GetFixedRouteAt(62, a).PrefDirMarker(7,
RouteCall,
false, Disp);
18269 for(
unsigned int a = 0; a < AllRoutesSize(); a++)
18271 GetFixedRouteAt(166, a).RouteImageMarker(0, Bitmap);
18289 AnsiString(VLoc) +
"," + AnsiString((
short)PrefDirRoute));
18290 for(
unsigned int a = 0; a < AllRoutesSize(); a++)
18293 RouteTruncateFlag =
true;
18295 GetModifiableRouteAt(7, a).GetRouteTruncateElement(0, HLoc, VLoc, PrefDirRoute, ReturnFlag);
18296 RouteTruncateFlag =
false;
18325 AnsiString(LinkPos));
18326 if(TrackVectorPosition == -1)
18331 THVPair Route2MultiMapKeyPair;
18335 int EntryLink, EntryLinkPos, ExitLink, ExitLinkPos;
18338 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 0)
18348 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 1)
18350 Route2MultiMapIterator = Route2MultiMap.find(Route2MultiMapKeyPair);
18353 const TPrefDirElement &PrefDirElement1 = GetFixedRouteAt(64, Route2MultiMapIterator->second.first).GetFixedPrefDirElementAt(88,
18354 Route2MultiMapIterator->second.second);
18355 EntryLinkPos = PrefDirElement1.
ELinkPos;
18356 ExitLinkPos = PrefDirElement1.
XLinkPos;
18357 EntryLink = PrefDirElement1.
Link[EntryLinkPos];
18358 ExitLink = PrefDirElement1.
Link[ExitLinkPos];
18370 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 2)
18382 Graphics::TBitmap* &EntryDirectionGraphicPtr)
18392 AnsiString(LinkPos));
18395 if(TrackVectorPosition == -1)
18400 THVPair Route2MultiMapKeyPair;
18404 int EntryLink, EntryLinkPos, ExitLink, ExitLinkPos;
18407 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 0)
18412 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 1)
18414 Route2MultiMapIterator = Route2MultiMap.find(Route2MultiMapKeyPair);
18416 const TPrefDirElement &PrefDirElement1 = GetFixedRouteAt(73, Route2MultiMapIterator->second.first).GetFixedPrefDirElementAt(97,
18417 Route2MultiMapIterator->second.second);
18418 EntryLinkPos = PrefDirElement1.
ELinkPos;
18419 ExitLinkPos = PrefDirElement1.
XLinkPos;
18420 EntryLink = PrefDirElement1.
Link[EntryLinkPos];
18421 ExitLink = PrefDirElement1.
Link[ExitLinkPos];
18425 if((Route2MultiMapIterator->second.second == 0) || (Route2MultiMapIterator->second.second == GetFixedRouteAt(74,
18426 Route2MultiMapIterator->second.first).PrefDirSize() - 1))
18433 return(AutoSigsRoute);
18438 return(NotAutoSigsRoute);
18444 if((Route2MultiMapIterator->second.second == 0) || (Route2MultiMapIterator->second.second == GetFixedRouteAt(75,
18445 Route2MultiMapIterator->second.first).PrefDirSize() - 1))
18452 return(AutoSigsRoute);
18457 return(NotAutoSigsRoute);
18461 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 2)
18463 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItPair;
18464 ItPair = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
18466 const TPrefDirElement &PrefDirElement2 = GetFixedRouteAt(76, ItPair.first->second.first).GetFixedPrefDirElementAt(98, ItPair.first->second.second);
18467 EntryLinkPos = PrefDirElement2.
ELinkPos;
18468 ExitLinkPos = PrefDirElement2.
XLinkPos;
18469 EntryLink = PrefDirElement2.
Link[EntryLinkPos];
18470 ExitLink = PrefDirElement2.
Link[ExitLinkPos];
18474 if((ItPair.first->second.second == 0) || (ItPair.first->second.second == GetFixedRouteAt(77, ItPair.first->second.first).PrefDirSize() - 1))
18481 return(AutoSigsRoute);
18486 return(NotAutoSigsRoute);
18492 if((ItPair.first->second.second == 0) || (ItPair.first->second.second == GetFixedRouteAt(78, ItPair.first->second.first).PrefDirSize() - 1))
18499 return(AutoSigsRoute);
18504 return(NotAutoSigsRoute);
18508 const TPrefDirElement &PrefDirElement3 = GetFixedRouteAt(79, ItPair.second->second.first).GetFixedPrefDirElementAt(99, ItPair.second->second.second);
18509 EntryLinkPos = PrefDirElement3.
ELinkPos;
18510 ExitLinkPos = PrefDirElement3.
XLinkPos;
18511 EntryLink = PrefDirElement3.
Link[EntryLinkPos];
18512 ExitLink = PrefDirElement3.
Link[ExitLinkPos];
18516 if((ItPair.second->second.second == 0) || (ItPair.second->second.second == GetFixedRouteAt(80, ItPair.second->second.first).PrefDirSize() - 1))
18523 return(AutoSigsRoute);
18528 return(NotAutoSigsRoute);
18534 if((ItPair.second->second.second == 0) || (ItPair.second->second.second == GetFixedRouteAt(81, ItPair.second->second.first).PrefDirSize() - 1))
18541 return(AutoSigsRoute);
18546 return(NotAutoSigsRoute);
18562 AnsiString(LinkPos));
18563 if(TrackVectorPosition == -1)
18569 THVPair Route2MultiMapKeyPair;
18573 int EntryLink, EntryLinkPos, ExitLink, ExitLinkPos;
18576 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 0)
18582 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 1)
18584 Route2MultiMapIterator = Route2MultiMap.find(Route2MultiMapKeyPair);
18586 const TPrefDirElement &PrefDirElement1 = GetFixedRouteAt(82, Route2MultiMapIterator->second.first).GetFixedPrefDirElementAt(100,
18587 Route2MultiMapIterator->second.second);
18588 EntryLinkPos = PrefDirElement1.
ELinkPos;
18589 ExitLinkPos = PrefDirElement1.
XLinkPos;
18590 EntryLink = PrefDirElement1.
Link[EntryLinkPos];
18591 ExitLink = PrefDirElement1.
Link[ExitLinkPos];
18594 RouteNumber = Route2MultiMapIterator->second.first;
18598 return(AutoSigsRoute);
18603 return(NotAutoSigsRoute);
18608 RouteNumber = Route2MultiMapIterator->second.first;
18612 return(AutoSigsRoute);
18617 return(NotAutoSigsRoute);
18621 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 2)
18623 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItPair;
18624 ItPair = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
18626 const TPrefDirElement &PrefDirElement2 = GetFixedRouteAt(83, ItPair.first->second.first).GetFixedPrefDirElementAt(101, ItPair.first->second.second);
18627 EntryLinkPos = PrefDirElement2.
ELinkPos;
18628 ExitLinkPos = PrefDirElement2.
XLinkPos;
18629 EntryLink = PrefDirElement2.
Link[EntryLinkPos];
18630 ExitLink = PrefDirElement2.
Link[ExitLinkPos];
18633 RouteNumber = ItPair.first->second.first;
18637 return(AutoSigsRoute);
18642 return(NotAutoSigsRoute);
18647 RouteNumber = ItPair.first->second.first;
18651 return(AutoSigsRoute);
18656 return(NotAutoSigsRoute);
18660 const TPrefDirElement &PrefDirElement3 = GetFixedRouteAt(84, ItPair.second->second.first).GetFixedPrefDirElementAt(102, ItPair.second->second.second);
18661 EntryLinkPos = PrefDirElement3.
ELinkPos;
18662 ExitLinkPos = PrefDirElement3.
XLinkPos;
18663 EntryLink = PrefDirElement3.
Link[EntryLinkPos];
18664 ExitLink = PrefDirElement3.
Link[ExitLinkPos];
18667 RouteNumber = ItPair.second->second.first;
18671 return(AutoSigsRoute);
18676 return(NotAutoSigsRoute);
18681 RouteNumber = ItPair.second->second.first;
18685 return(AutoSigsRoute);
18690 return(NotAutoSigsRoute);
18712 EmptyRoute.
RouteID = NextRouteID;
18715 AllRoutesVector.push_back(EmptyRoute);
18716 for(
unsigned int x = 0; x < Route->
PrefDirSize(); x++)
18741 AllRoutesVector.push_back(EmptyRoute);
18742 for(
unsigned int x = 0; x < Route->
PrefDirSize(); x++)
18765 THVPair Route2MultiMapKeyPair;
18774 LockedRouteTruncateTrackVectorPosition = 0;
18775 LockedRouteLastTrackVectorPosition = 0;
18776 LockedRouteLastXLinkPos = 0;
18777 LockedRouteLockStartTime = TDateTime(0);
18778 if(!LockedRouteVector.empty())
18782 if(LRVIT->RouteNumber == RouteNumber)
18784 LockedRouteTruncateTrackVectorPosition = LRVIT->TruncateTrackVectorPosition;
18785 LockedRouteLastTrackVectorPosition = LRVIT->LastTrackVectorPosition;
18786 LockedRouteLastXLinkPos = LRVIT->LastXLinkPos;
18787 LockedRouteLockStartTime = LRVIT->LockStartTime;
18788 LockedRouteFoundDuringRouteBuilding =
true;
18789 LockedRouteVector.erase(LRVIT);
18814 AnsiString(VLoc) +
"," + AnsiString(ELink));
18817 ReturnPair.first = -1;
18818 ReturnPair.second = 0;
18819 THVPair Route2MultiMapKeyPair;
18821 Route2MultiMapKeyPair.first = HLoc;
18822 Route2MultiMapKeyPair.second = VLoc;
18825 Route2MultiMapEntry.first = Route2MultiMapKeyPair;
18826 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItPair;
18828 ItPair = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
18829 Route2MultiMapIterator = ItPair.first;
18831 if(ItPair.first == ItPair.second)
18833 throw Exception(
"Failed to find Route2MultiMap element at HLoc = " + (AnsiString)HLoc +
" VLoc = " + (AnsiString)VLoc);
18835 if(GetFixedRouteAt(111, ItPair.first->second.first).GetFixedPrefDirElementAt(132, ItPair.first->second.second).GetELink() == ELink)
18837 ReturnPair.first = ItPair.first->second.first;
18838 ReturnPair.second = ItPair.first->second.second;
18839 Route2MultiMapIterator = ItPair.first;
18841 return(ReturnPair);
18844 if(ItPair.first == ItPair.second)
18846 throw Exception(
"Found Route2MultiMap element at HLoc = " + (AnsiString)HLoc +
" VLoc = " + (AnsiString)VLoc +
" but failed to find required element");
18848 if(GetFixedRouteAt(112, ItPair.first->second.first).GetFixedPrefDirElementAt(133, ItPair.first->second.second).GetELink() == ELink)
18850 ReturnPair.first = ItPair.first->second.first;
18851 ReturnPair.second = ItPair.first->second.second;
18852 Route2MultiMapIterator = ItPair.first;
18854 return(ReturnPair);
18857 return(ReturnPair);
18872 AnsiString(VLoc) +
"," + AnsiString(ELink));
18873 THVPair Route2MultiMapKeyPair;
18875 Route2MultiMapKeyPair.first = HLoc;
18876 Route2MultiMapKeyPair.second = VLoc;
18877 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItPair;
18879 ItPair = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
18881 if(ItPair.first == ItPair.second)
18887 if(GetFixedRouteAt(205, ItPair.first->second.first).GetFixedPrefDirElementAt(241, ItPair.first->second.second).GetELink() == ELink)
18889 RouteNumber = ItPair.first->second.first;
18895 if(ItPair.first == ItPair.second)
18901 if(GetFixedRouteAt(206, ItPair.first->second.first).GetFixedPrefDirElementAt(242, ItPair.first->second.second).GetELink() == ELink)
18903 RouteNumber = ItPair.first->second.first;
18924 "," + AnsiString(ELinkIn) +
"," + AnsiString(RouteNumber) +
"," + AnsiString(RouteElementNumber));
18925 THVPair Route2MultiMapKeyPair;
18927 Route2MultiMapKeyPair.first = HLoc;
18928 Route2MultiMapKeyPair.second = VLoc;
18931 Route2MultiMapEntry.first = Route2MultiMapKeyPair;
18934 RouteElementPair.first = RouteNumber;
18935 RouteElementPair.second = RouteElementNumber;
18936 Route2MultiMapEntry.second = RouteElementPair;
18938 if(Route2MultiMap.find(Route2MultiMapKeyPair) != Route2MultiMap.end())
18941 if(GetFixedRouteAt(113, Route2MultiMap.find(Route2MultiMapKeyPair)->second.first).GetFixedPrefDirElementAt(134,
18942 Route2MultiMap.find(Route2MultiMapKeyPair)->second.second).GetELink() != ELinkIn)
18945 if(GetFixedRouteAt(114, Route2MultiMap.find(Route2MultiMapKeyPair)->second.first).GetFixedPrefDirElementAt(135,
18946 Route2MultiMap.find(Route2MultiMapKeyPair)->second.second).TrackType !=
Bridge)
18948 throw Exception(
"Error, bridge expected in Route2MultiMapInsert but not, at HLoc=" + AnsiString(HLoc) +
" VLoc=" + AnsiString(VLoc));
18950 Route2MultiMap.insert(Route2MultiMapEntry);
18955 throw Exception(
"Error, route map entry found in Route2MultiMapInsert at HLoc=" + AnsiString(HLoc) +
" VLoc=" + AnsiString(VLoc));
18960 Route2MultiMap.insert(Route2MultiMapEntry);
18978 TempPair.first = -1;
18979 TempPair.second = 0;
18980 SecondPair = TempPair;
18982 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItRange;
18983 THVPair Route2MultiMapKeyPair;
18985 Route2MultiMapKeyPair.first = HLoc;
18986 Route2MultiMapKeyPair.second = VLoc;
18987 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 0)
18992 else if(Route2MultiMap.count(Route2MultiMapKeyPair) == 1)
18994 Route2MultiMapIterator = Route2MultiMap.find(Route2MultiMapKeyPair);
18996 return(Route2MultiMapIterator->second);
18998 else if(Route2MultiMap.count(Route2MultiMapKeyPair) == 2)
19000 ItRange = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
19001 TempPair = ItRange.first->second;
19002 SecondPair = (--ItRange.second)->second;
19025 TRouteElementPair RouteElementPair = GetRouteElementDataFromRoute2MultiMap(8, CheckElement.
HLoc, CheckElement.
VLoc, SecondPair);
19026 if(RouteElementPair.first == -1)
19029 throw Exception(
"CheckMapAndRoutes Error - failed to find HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" + (AnsiString)CheckElement.
VLoc +
19030 " in Route2MultiMap, Caller=" + (AnsiString)Caller);
19032 if((RouteElementPair.first != (
int)a) && (SecondPair.first != (
int)a))
19035 throw Exception(
"CheckMapAndRoutes Error - RouteNumber failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
19036 (AnsiString)CheckElement.
VLoc +
" Map value=" + (AnsiString)RouteElementPair.first +
" Route value=" + (AnsiString)a +
" Caller=" +
19037 (AnsiString)Caller);
19039 if(((RouteElementPair.first != (
int)a) || (RouteElementPair.second != b)) && ((SecondPair.first != (
int)a) || (SecondPair.second != b)))
19042 throw Exception(
"CheckMapAndRoutes Error - PrefDirVectorNumber failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
19043 (AnsiString)CheckElement.
VLoc +
" 1st Map value RouteNum/ElementNum =" + (AnsiString)RouteElementPair.first +
"/" +
19044 (AnsiString)RouteElementPair.second +
" 2nd Map value =" + (AnsiString)SecondPair.first +
"/" + (AnsiString)SecondPair.second +
19045 " Route value=" + (AnsiString)a +
"/" + (AnsiString)b +
" Caller=" + (AnsiString)Caller);
19049 unsigned int SizeVal = 0;
19052 for(
unsigned int a = 0; a < AllRoutesSize(); a++)
19054 SizeVal += GetFixedRouteAt(117, a).PrefDirSize();
19056 if(SizeVal != Route2MultiMap.size())
19058 throw Exception(
"CheckMapAndRoutes Error - Map Size=" + (AnsiString)Route2MultiMap.size() +
" RouteSize=" + (AnsiString)SizeVal +
" Caller=" +
19059 (AnsiString)Caller);
19075 if(!Route2MultiMap.empty())
19077 for(
TRoute2MultiMapIterator Route2MultiMapIterator = Route2MultiMap.begin(); Route2MultiMapIterator != Route2MultiMap.end(); Route2MultiMapIterator++)
19079 if(Route2MultiMapIterator->second.first > RouteNumber)
19081 Route2MultiMapIterator->second.first--;
19098 AnsiString(RouteNumber) +
"," + AnsiString(ErasedElementNumber));
19099 if(!Route2MultiMap.empty())
19101 for(
TRoute2MultiMapIterator Route2MultiMapIterator = Route2MultiMap.begin(); Route2MultiMapIterator != Route2MultiMap.end(); Route2MultiMapIterator++)
19103 if((Route2MultiMapIterator->second.first == RouteNumber) && (Route2MultiMapIterator->second.second > ErasedElementNumber))
19105 Route2MultiMapIterator->second.second--;
19124 AnsiString(ELink));
19128 RequiredRoutePair = FindRoutePairFromRoute2MultiMap(0, HLoc, VLoc, ELink, Route2MultiMapIterator);
19129 if(RequiredRoutePair.first == -1)
19131 throw Exception(
"Failed to find route element in RemoveRouteElement");
19133 Route2MultiMap.erase(Route2MultiMapIterator);
19134 DecrementRouteElementNumbersInRoute2MultiMap(0, RequiredRoutePair.first, RequiredRoutePair.second);
19137 TPrefDirElement LockedRouteElement, PrefDirElement = GetFixedRouteAt(118, RequiredRoutePair.first).GetFixedPrefDirElementAt(137, RequiredRoutePair.second);
19158 GetModifiableRouteAt(8, RequiredRoutePair.first).EraseRouteElementAt(&(GetModifiableRouteAt(9, RequiredRoutePair.first).GetModifiablePrefDirElementAt(1,
19159 RequiredRoutePair.second)));
19170 if(AutoSigVectorIT->RouteNumber == RequiredRoutePair.first)
19178 if(GetModifiableRouteAt(10, RequiredRoutePair.first).PrefDirSize() == 0)
19180 TrainController->
LogEvent(
"RouteRemoved," + AnsiString(GetFixedRouteAt(189, RequiredRoutePair.first).RouteID));
19181 AllRoutesVector.erase(AllRoutesVector.begin() + RequiredRoutePair.first);
19182 DecrementRouteNumbersInRoute2MultiMap(0, RequiredRoutePair.first);
19194 if(!LockedRouteVector.empty())
19198 if(LRVIT->RouteNumber > RequiredRoutePair.first)
19200 LRVIT->RouteNumber--;
19210 if(AutoSigVectorIT->RouteNumber > RequiredRoutePair.first)
19212 AutoSigVectorIT->RouteNumber--;
19217 CheckMapAndRoutes(7);
19231 AnsiString(ELink) +
"," + AnsiString(RouteNumber) +
"," + RouteElement.
LogPrefDir());
19232 GetModifiableRouteAt(11, RouteNumber).StoreRouteElementInPrefDirVector(RouteElement);
19233 Route2MultiMapInsert(0, HLoc, VLoc, ELink, RouteNumber, GetModifiableRouteAt(12, RouteNumber).
PrefDirSize() - 1);
19249 "," + AnsiString(XLinkPos));
19253 RouteElementPair = GetRouteElementDataFromRoute2MultiMap(9, TE.
HLoc, TE.
VLoc, SecondPair);
19254 if(RouteElementPair.first == -1)
19256 throw Exception(
"Error, failed to find element in SetTrailingSignalsOnAutoSigsRoute - 1");
19258 TPrefDirElement RouteElement = GetFixedRouteAt(119, RouteElementPair.first).GetFixedPrefDirElementAt(138, RouteElementPair.second);
19260 RequiredPair = RouteElementPair;
19261 if(RouteElement.
XLinkPos != XLinkPos)
19263 if(SecondPair.first != -1)
19265 RouteElement = GetFixedRouteAt(120, SecondPair.first).GetFixedPrefDirElementAt(139, SecondPair.second);
19266 RequiredPair = SecondPair;
19267 if(RouteElement.
XLinkPos != XLinkPos)
19269 throw Exception(
"Failed to find element in route in SetTrailingSignalsOnAutoSigsRoute - 2");
19274 throw Exception(
"Failed to find element in route in SetTrailingSignalsOnAutoSigsRoute - 3");
19278 SetAllRearwardsSignals(5, 0, RequiredPair.first, RequiredPair.second);
19298 AnsiString(AccessNumber));
19300 int Attribute = AccessNumber + 1;
19302 int x = GetFixedRouteAt(121, RouteNumber).PrefDirSize() - 1;
19306 throw Exception(
"Error - route not AutoSignals in SetTrailingSignalsOnContinuationRoute");
19310 throw Exception(
"Error - end element not continuation in SetTrailingSignalsOnContinuationRoute");
19313 x).XLinkPos] !=
End)
19315 throw Exception(
"Error - end element a continuation in SetTrailingSignalsOnContinuationRoute but End not facing right way");
19318 SetAllRearwardsSignals(6, Attribute, RouteNumber, GetFixedRouteAt(126, RouteNumber).
PrefDirSize() - 1);
19361 AnsiString(RouteNumber) +
"," + AnsiString(RouteStartPosition));
19362 TPrefDirElement FirstElement = GetFixedRouteAt(127, RouteNumber).GetFixedPrefDirElementAt(144, 0);
19363 int RearwardLinkedRouteNumber;
19389 int TrainID, TrainPosition, BehindTrainPosition;
19390 bool FoundTrain =
false, BehindTrain =
false;
19391 for(
int x = RouteStartPosition; x >= 0; x--)
19393 TPrefDirElement PrefDirElement = GetFixedRouteAt(132, RouteNumber).GetFixedPrefDirElementAt(146, x);
19418 if(FoundTrain && (TrainPosition > 1))
19420 for(
int x = TrainPosition; x >= 0; x--)
19425 TPrefDirElement PrefDirElement = GetFixedRouteAt(133, RouteNumber).GetFixedPrefDirElementAt(147, x);
19445 BehindTrain =
true;
19446 BehindTrainPosition = x;
19453 SetAllRearwardsSignals(7, 0, RouteNumber, BehindTrainPosition);
19470 AnsiString(RouteTruncatePosition));
19471 int SignalCount = 0, TrainID, RearwardLinkedRouteNumber, StartPosition = RouteTruncatePosition;
19472 TOneRoute CurrentRoute = GetFixedRouteAt(134, RouteNumber);
19475 bool ExamineRoute =
true;
19477 while(ExamineRoute)
19479 for(
int x = StartPosition; x >= 0; x--)
19521 if(SignalCount >= 3)
19540 CurrentRoute = GetFixedRouteAt(135, RearwardLinkedRouteNumber);
19541 ExamineRoute =
true;
19542 StartPosition = GetFixedRouteAt(136, RearwardLinkedRouteNumber).PrefDirSize() - 1;
19577 ExamineRoute =
false;
19592 AnsiString(TrackVectorPosition) +
"," + AnsiString(XLinkPos));
19595 PrefDirElement = InternalPrefDirElement;
19596 if(LockedRouteVector.empty())
19603 bool InLockedRoute =
false;
19607 if(TrackIsInARoute(14, LRVIT->LastTrackVectorPosition, LRVIT->LastXLinkPos))
19611 InLockedRoute =
true;
19620 int RouteNumber, VectorCount = 0;
19625 RouteType = GetRouteTypeAndNumber(8, LRVIT->LastTrackVectorPosition, LRVIT->LastXLinkPos, RouteNumber);
19626 if(RouteType == NoRoute)
19632 GetFixedRouteAt(140, RouteNumber).
PrefDirSize() - 1).XLinkPos != LRVIT->LastXLinkPos))
19635 (
"Error, last element in locked route doesn't correspond with last element in associated route in IsElementInLockedRouteGetPrefDirElement");
19637 for(
int x = GetFixedRouteAt(141, RouteNumber).
PrefDirSize() - 1; x >= 0; x--)
19639 InternalPrefDirElement = GetFixedRouteAt(142, RouteNumber).GetFixedPrefDirElementAt(152, x);
19640 if(InternalPrefDirElement.
TrackVectorPosition != (
int)LRVIT->TruncateTrackVectorPosition)
19644 PrefDirElement = InternalPrefDirElement;
19645 LockedVectorNumber = VectorCount;
19650 else if(InternalPrefDirElement.
TrackVectorPosition == (
int)LRVIT->TruncateTrackVectorPosition)
19654 PrefDirElement = InternalPrefDirElement;
19655 LockedVectorNumber = VectorCount;
19676 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
19678 if(GetFixedRouteAt(157, x).RouteID ==
RouteID.GetInt())
19684 throw Exception(
"Error, failed to find RouteID in GetRouteVectorNumber for ID: " + AnsiString(
RouteID.GetInt()));
19694 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
19696 if(GetFixedRouteAt(45, x).RouteID ==
RouteID.GetInt())
19711 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
19713 if(GetFixedRouteAt(163, x).RouteID ==
RouteID.GetInt())
19716 return(GetFixedRouteAt(159, x));
19719 throw Exception(
"Error, failed to find RouteID in GetFixedRouteAtIDNumber for ID: " + AnsiString(
RouteID.GetInt()));
19727 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
19729 if(GetFixedRouteAt(164, x).RouteID ==
RouteID.GetInt())
19732 return(GetModifiableRouteAt(15, x));
19735 throw Exception(
"Error, failed to find RouteID in GetModifiableRouteAtIDNumber for ID: " + AnsiString(
RouteID.GetInt()));
19745 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
19747 TOneRoute OneRoute = GetFixedRouteAt(165, x);
19759 int NumberOfRoutes;
19763 for(
int x = 0; x < NumberOfRoutes; x++)
19770 StoreOneRouteAfterSessionLoad(0, &OneRoute);
19788 if((NumberOfRoutes < 0) || (NumberOfRoutes > 5000))
19795 if((NextID < 0) || (NextID > 1000000))
19800 for(
int x = 0; x < NumberOfRoutes; x++)
19825 AnsiString(StartPosition));
19826 if(EndPosition == StartPosition)
19832 int TVPos = EndPosition;
19833 int LkPos = EndXLinkPos;
19835 while(TrackIsInARoute(15, TVPos, LkPos))
19862 if(GetRouteTypeAndNumber(36, NewTVPos, NewLkPos, RouteNumber) == NoRoute)
19871 if((NewLkPos == 0) || (NewLkPos == 2))
19891 if(TVPos == StartPosition)
19923 AnsiString(VLoc) +
"," + AnsiString(DiagonalLinkNumber));
19928 if(FirstPair.first > -1)
19931 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
19936 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
19942 if(SecondPair.first > -1)
19945 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
19950 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
19956 if(((DiagonalLinkNumber == 1) &&
Track->
TrainOnLink(0, HLoc - 1, VLoc, 3, TrainID)) || ((DiagonalLinkNumber == 7) &&
Track->
TrainOnLink(1, HLoc - 1, VLoc,
19963 if(FirstPair.first > -1)
19966 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
19971 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
19977 if(SecondPair.first > -1)
19980 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
19985 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
19991 if(((DiagonalLinkNumber == 1) &&
Track->
TrainOnLink(2, HLoc, VLoc - 1, 7, TrainID)) || ((DiagonalLinkNumber == 3) &&
Track->
TrainOnLink(3, HLoc, VLoc - 1,
19998 if(FirstPair.first > -1)
20001 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
20006 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
20012 if(SecondPair.first > -1)
20015 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
20020 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
20026 if(((DiagonalLinkNumber == 3) &&
Track->
TrainOnLink(4, HLoc + 1, VLoc, 1, TrainID)) || ((DiagonalLinkNumber == 9) &&
Track->
TrainOnLink(5, HLoc + 1, VLoc,
20033 if(FirstPair.first > -1)
20036 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
20041 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
20047 if(SecondPair.first > -1)
20050 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
20055 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
20061 if(((DiagonalLinkNumber == 7) &&
Track->
TrainOnLink(6, HLoc, VLoc + 1, 1, TrainID)) || ((DiagonalLinkNumber == 9) &&
Track->
TrainOnLink(7, HLoc, VLoc + 1,
20085 "," + AnsiString(DiagonalLinkNumber));
20090 if(FirstPair.first > -1)
20093 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
20098 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
20104 if(SecondPair.first > -1)
20107 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
20112 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
20119 if(FirstPair.first > -1)
20122 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
20127 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
20133 if(SecondPair.first > -1)
20136 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
20141 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
20148 if(FirstPair.first > -1)
20151 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
20156 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
20162 if(SecondPair.first > -1)
20165 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
20170 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
20177 if(FirstPair.first > -1)
20180 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
20185 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
20191 if(SecondPair.first > -1)
20194 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
20199 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))